
obj/user/spin.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 88 00 00 00       	call   8000b9 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	53                   	push   %ebx
  80003b:	83 ec 10             	sub    $0x10,%esp
	envid_t env;

	cprintf("I am the parent.  Forking the child...\n");
  80003e:	68 20 23 80 00       	push   $0x802320
  800043:	e8 80 01 00 00       	call   8001c8 <cprintf>
	if ((env = fork()) == 0) {
  800048:	e8 cd 0e 00 00       	call   800f1a <fork>
  80004d:	83 c4 10             	add    $0x10,%esp
  800050:	85 c0                	test   %eax,%eax
  800052:	75 12                	jne    800066 <umain+0x33>
		cprintf("I am the child.  Spinning...\n");
  800054:	83 ec 0c             	sub    $0xc,%esp
  800057:	68 98 23 80 00       	push   $0x802398
  80005c:	e8 67 01 00 00       	call   8001c8 <cprintf>
  800061:	83 c4 10             	add    $0x10,%esp
  800064:	eb fe                	jmp    800064 <umain+0x31>
  800066:	89 c3                	mov    %eax,%ebx
		while (1)
			/* do nothing */;
	}

	cprintf("I am the parent.  Running the child...\n");
  800068:	83 ec 0c             	sub    $0xc,%esp
  80006b:	68 48 23 80 00       	push   $0x802348
  800070:	e8 53 01 00 00       	call   8001c8 <cprintf>
	sys_yield();
  800075:	e8 46 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  80007a:	e8 41 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  80007f:	e8 3c 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  800084:	e8 37 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  800089:	e8 32 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  80008e:	e8 2d 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  800093:	e8 28 0b 00 00       	call   800bc0 <sys_yield>
	sys_yield();
  800098:	e8 23 0b 00 00       	call   800bc0 <sys_yield>

	cprintf("I am the parent.  Killing the child...\n");
  80009d:	c7 04 24 70 23 80 00 	movl   $0x802370,(%esp)
  8000a4:	e8 1f 01 00 00       	call   8001c8 <cprintf>
	sys_env_destroy(env);
  8000a9:	89 1c 24             	mov    %ebx,(%esp)
  8000ac:	e8 a7 0a 00 00       	call   800b58 <sys_env_destroy>
}
  8000b1:	83 c4 10             	add    $0x10,%esp
  8000b4:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8000b7:	c9                   	leave  
  8000b8:	c3                   	ret    

008000b9 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8000b9:	f3 0f 1e fb          	endbr32 
  8000bd:	55                   	push   %ebp
  8000be:	89 e5                	mov    %esp,%ebp
  8000c0:	56                   	push   %esi
  8000c1:	53                   	push   %ebx
  8000c2:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8000c5:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8000c8:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8000cf:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8000d2:	e8 c6 0a 00 00       	call   800b9d <sys_getenvid>
  8000d7:	25 ff 03 00 00       	and    $0x3ff,%eax
  8000dc:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8000df:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8000e4:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  8000e9:	85 db                	test   %ebx,%ebx
  8000eb:	7e 07                	jle    8000f4 <libmain+0x3b>
		binaryname = argv[0];
  8000ed:	8b 06                	mov    (%esi),%eax
  8000ef:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  8000f4:	83 ec 08             	sub    $0x8,%esp
  8000f7:	56                   	push   %esi
  8000f8:	53                   	push   %ebx
  8000f9:	e8 35 ff ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  8000fe:	e8 0a 00 00 00       	call   80010d <exit>
}
  800103:	83 c4 10             	add    $0x10,%esp
  800106:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800109:	5b                   	pop    %ebx
  80010a:	5e                   	pop    %esi
  80010b:	5d                   	pop    %ebp
  80010c:	c3                   	ret    

0080010d <exit>:

#include <inc/lib.h>

void
exit(void)
{
  80010d:	f3 0f 1e fb          	endbr32 
  800111:	55                   	push   %ebp
  800112:	89 e5                	mov    %esp,%ebp
  800114:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800117:	e8 08 12 00 00       	call   801324 <close_all>
	sys_env_destroy(0);
  80011c:	83 ec 0c             	sub    $0xc,%esp
  80011f:	6a 00                	push   $0x0
  800121:	e8 32 0a 00 00       	call   800b58 <sys_env_destroy>
}
  800126:	83 c4 10             	add    $0x10,%esp
  800129:	c9                   	leave  
  80012a:	c3                   	ret    

0080012b <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  80012b:	f3 0f 1e fb          	endbr32 
  80012f:	55                   	push   %ebp
  800130:	89 e5                	mov    %esp,%ebp
  800132:	53                   	push   %ebx
  800133:	83 ec 04             	sub    $0x4,%esp
  800136:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  800139:	8b 13                	mov    (%ebx),%edx
  80013b:	8d 42 01             	lea    0x1(%edx),%eax
  80013e:	89 03                	mov    %eax,(%ebx)
  800140:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800143:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  800147:	3d ff 00 00 00       	cmp    $0xff,%eax
  80014c:	74 09                	je     800157 <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  80014e:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  800152:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800155:	c9                   	leave  
  800156:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  800157:	83 ec 08             	sub    $0x8,%esp
  80015a:	68 ff 00 00 00       	push   $0xff
  80015f:	8d 43 08             	lea    0x8(%ebx),%eax
  800162:	50                   	push   %eax
  800163:	e8 ab 09 00 00       	call   800b13 <sys_cputs>
		b->idx = 0;
  800168:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  80016e:	83 c4 10             	add    $0x10,%esp
  800171:	eb db                	jmp    80014e <putch+0x23>

00800173 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  800173:	f3 0f 1e fb          	endbr32 
  800177:	55                   	push   %ebp
  800178:	89 e5                	mov    %esp,%ebp
  80017a:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  800180:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  800187:	00 00 00 
	b.cnt = 0;
  80018a:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  800191:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  800194:	ff 75 0c             	pushl  0xc(%ebp)
  800197:	ff 75 08             	pushl  0x8(%ebp)
  80019a:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  8001a0:	50                   	push   %eax
  8001a1:	68 2b 01 80 00       	push   $0x80012b
  8001a6:	e8 20 01 00 00       	call   8002cb <vprintfmt>
	sys_cputs(b.buf, b.idx);
  8001ab:	83 c4 08             	add    $0x8,%esp
  8001ae:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  8001b4:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  8001ba:	50                   	push   %eax
  8001bb:	e8 53 09 00 00       	call   800b13 <sys_cputs>

	return b.cnt;
}
  8001c0:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  8001c6:	c9                   	leave  
  8001c7:	c3                   	ret    

008001c8 <cprintf>:

int
cprintf(const char *fmt, ...)
{
  8001c8:	f3 0f 1e fb          	endbr32 
  8001cc:	55                   	push   %ebp
  8001cd:	89 e5                	mov    %esp,%ebp
  8001cf:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  8001d2:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  8001d5:	50                   	push   %eax
  8001d6:	ff 75 08             	pushl  0x8(%ebp)
  8001d9:	e8 95 ff ff ff       	call   800173 <vcprintf>
	va_end(ap);

	return cnt;
}
  8001de:	c9                   	leave  
  8001df:	c3                   	ret    

008001e0 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  8001e0:	55                   	push   %ebp
  8001e1:	89 e5                	mov    %esp,%ebp
  8001e3:	57                   	push   %edi
  8001e4:	56                   	push   %esi
  8001e5:	53                   	push   %ebx
  8001e6:	83 ec 1c             	sub    $0x1c,%esp
  8001e9:	89 c7                	mov    %eax,%edi
  8001eb:	89 d6                	mov    %edx,%esi
  8001ed:	8b 45 08             	mov    0x8(%ebp),%eax
  8001f0:	8b 55 0c             	mov    0xc(%ebp),%edx
  8001f3:	89 d1                	mov    %edx,%ecx
  8001f5:	89 c2                	mov    %eax,%edx
  8001f7:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8001fa:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  8001fd:	8b 45 10             	mov    0x10(%ebp),%eax
  800200:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800203:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800206:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  80020d:	39 c2                	cmp    %eax,%edx
  80020f:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800212:	72 3e                	jb     800252 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800214:	83 ec 0c             	sub    $0xc,%esp
  800217:	ff 75 18             	pushl  0x18(%ebp)
  80021a:	83 eb 01             	sub    $0x1,%ebx
  80021d:	53                   	push   %ebx
  80021e:	50                   	push   %eax
  80021f:	83 ec 08             	sub    $0x8,%esp
  800222:	ff 75 e4             	pushl  -0x1c(%ebp)
  800225:	ff 75 e0             	pushl  -0x20(%ebp)
  800228:	ff 75 dc             	pushl  -0x24(%ebp)
  80022b:	ff 75 d8             	pushl  -0x28(%ebp)
  80022e:	e8 8d 1e 00 00       	call   8020c0 <__udivdi3>
  800233:	83 c4 18             	add    $0x18,%esp
  800236:	52                   	push   %edx
  800237:	50                   	push   %eax
  800238:	89 f2                	mov    %esi,%edx
  80023a:	89 f8                	mov    %edi,%eax
  80023c:	e8 9f ff ff ff       	call   8001e0 <printnum>
  800241:	83 c4 20             	add    $0x20,%esp
  800244:	eb 13                	jmp    800259 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  800246:	83 ec 08             	sub    $0x8,%esp
  800249:	56                   	push   %esi
  80024a:	ff 75 18             	pushl  0x18(%ebp)
  80024d:	ff d7                	call   *%edi
  80024f:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  800252:	83 eb 01             	sub    $0x1,%ebx
  800255:	85 db                	test   %ebx,%ebx
  800257:	7f ed                	jg     800246 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  800259:	83 ec 08             	sub    $0x8,%esp
  80025c:	56                   	push   %esi
  80025d:	83 ec 04             	sub    $0x4,%esp
  800260:	ff 75 e4             	pushl  -0x1c(%ebp)
  800263:	ff 75 e0             	pushl  -0x20(%ebp)
  800266:	ff 75 dc             	pushl  -0x24(%ebp)
  800269:	ff 75 d8             	pushl  -0x28(%ebp)
  80026c:	e8 5f 1f 00 00       	call   8021d0 <__umoddi3>
  800271:	83 c4 14             	add    $0x14,%esp
  800274:	0f be 80 c0 23 80 00 	movsbl 0x8023c0(%eax),%eax
  80027b:	50                   	push   %eax
  80027c:	ff d7                	call   *%edi
}
  80027e:	83 c4 10             	add    $0x10,%esp
  800281:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800284:	5b                   	pop    %ebx
  800285:	5e                   	pop    %esi
  800286:	5f                   	pop    %edi
  800287:	5d                   	pop    %ebp
  800288:	c3                   	ret    

00800289 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  800289:	f3 0f 1e fb          	endbr32 
  80028d:	55                   	push   %ebp
  80028e:	89 e5                	mov    %esp,%ebp
  800290:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  800293:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  800297:	8b 10                	mov    (%eax),%edx
  800299:	3b 50 04             	cmp    0x4(%eax),%edx
  80029c:	73 0a                	jae    8002a8 <sprintputch+0x1f>
		*b->buf++ = ch;
  80029e:	8d 4a 01             	lea    0x1(%edx),%ecx
  8002a1:	89 08                	mov    %ecx,(%eax)
  8002a3:	8b 45 08             	mov    0x8(%ebp),%eax
  8002a6:	88 02                	mov    %al,(%edx)
}
  8002a8:	5d                   	pop    %ebp
  8002a9:	c3                   	ret    

008002aa <printfmt>:
{
  8002aa:	f3 0f 1e fb          	endbr32 
  8002ae:	55                   	push   %ebp
  8002af:	89 e5                	mov    %esp,%ebp
  8002b1:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  8002b4:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  8002b7:	50                   	push   %eax
  8002b8:	ff 75 10             	pushl  0x10(%ebp)
  8002bb:	ff 75 0c             	pushl  0xc(%ebp)
  8002be:	ff 75 08             	pushl  0x8(%ebp)
  8002c1:	e8 05 00 00 00       	call   8002cb <vprintfmt>
}
  8002c6:	83 c4 10             	add    $0x10,%esp
  8002c9:	c9                   	leave  
  8002ca:	c3                   	ret    

008002cb <vprintfmt>:
{
  8002cb:	f3 0f 1e fb          	endbr32 
  8002cf:	55                   	push   %ebp
  8002d0:	89 e5                	mov    %esp,%ebp
  8002d2:	57                   	push   %edi
  8002d3:	56                   	push   %esi
  8002d4:	53                   	push   %ebx
  8002d5:	83 ec 3c             	sub    $0x3c,%esp
  8002d8:	8b 75 08             	mov    0x8(%ebp),%esi
  8002db:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  8002de:	8b 7d 10             	mov    0x10(%ebp),%edi
  8002e1:	e9 5d 03 00 00       	jmp    800643 <vprintfmt+0x378>
		padc = ' ';
  8002e6:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  8002ea:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  8002f1:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  8002f8:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  8002ff:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800304:	8d 47 01             	lea    0x1(%edi),%eax
  800307:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80030a:	0f b6 17             	movzbl (%edi),%edx
  80030d:	8d 42 dd             	lea    -0x23(%edx),%eax
  800310:	3c 55                	cmp    $0x55,%al
  800312:	0f 87 ae 03 00 00    	ja     8006c6 <vprintfmt+0x3fb>
  800318:	0f b6 c0             	movzbl %al,%eax
  80031b:	3e ff 24 85 00 25 80 	notrack jmp *0x802500(,%eax,4)
  800322:	00 
  800323:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  800326:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  80032a:	eb d8                	jmp    800304 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80032c:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  80032f:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800333:	eb cf                	jmp    800304 <vprintfmt+0x39>
  800335:	0f b6 d2             	movzbl %dl,%edx
  800338:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  80033b:	b8 00 00 00 00       	mov    $0x0,%eax
  800340:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  800343:	8d 04 80             	lea    (%eax,%eax,4),%eax
  800346:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  80034a:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  80034d:	8d 4a d0             	lea    -0x30(%edx),%ecx
  800350:	83 f9 09             	cmp    $0x9,%ecx
  800353:	77 55                	ja     8003aa <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  800355:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  800358:	eb e9                	jmp    800343 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  80035a:	8b 45 14             	mov    0x14(%ebp),%eax
  80035d:	8b 00                	mov    (%eax),%eax
  80035f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800362:	8b 45 14             	mov    0x14(%ebp),%eax
  800365:	8d 40 04             	lea    0x4(%eax),%eax
  800368:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  80036b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  80036e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800372:	79 90                	jns    800304 <vprintfmt+0x39>
				width = precision, precision = -1;
  800374:	8b 45 d8             	mov    -0x28(%ebp),%eax
  800377:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  80037a:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  800381:	eb 81                	jmp    800304 <vprintfmt+0x39>
  800383:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  800386:	85 c0                	test   %eax,%eax
  800388:	ba 00 00 00 00       	mov    $0x0,%edx
  80038d:	0f 49 d0             	cmovns %eax,%edx
  800390:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  800393:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  800396:	e9 69 ff ff ff       	jmp    800304 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  80039b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  80039e:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  8003a5:	e9 5a ff ff ff       	jmp    800304 <vprintfmt+0x39>
  8003aa:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  8003ad:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8003b0:	eb bc                	jmp    80036e <vprintfmt+0xa3>
			lflag++;
  8003b2:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  8003b5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8003b8:	e9 47 ff ff ff       	jmp    800304 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  8003bd:	8b 45 14             	mov    0x14(%ebp),%eax
  8003c0:	8d 78 04             	lea    0x4(%eax),%edi
  8003c3:	83 ec 08             	sub    $0x8,%esp
  8003c6:	53                   	push   %ebx
  8003c7:	ff 30                	pushl  (%eax)
  8003c9:	ff d6                	call   *%esi
			break;
  8003cb:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  8003ce:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  8003d1:	e9 6a 02 00 00       	jmp    800640 <vprintfmt+0x375>
			err = va_arg(ap, int);
  8003d6:	8b 45 14             	mov    0x14(%ebp),%eax
  8003d9:	8d 78 04             	lea    0x4(%eax),%edi
  8003dc:	8b 00                	mov    (%eax),%eax
  8003de:	99                   	cltd   
  8003df:	31 d0                	xor    %edx,%eax
  8003e1:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  8003e3:	83 f8 0f             	cmp    $0xf,%eax
  8003e6:	7f 23                	jg     80040b <vprintfmt+0x140>
  8003e8:	8b 14 85 60 26 80 00 	mov    0x802660(,%eax,4),%edx
  8003ef:	85 d2                	test   %edx,%edx
  8003f1:	74 18                	je     80040b <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  8003f3:	52                   	push   %edx
  8003f4:	68 e1 28 80 00       	push   $0x8028e1
  8003f9:	53                   	push   %ebx
  8003fa:	56                   	push   %esi
  8003fb:	e8 aa fe ff ff       	call   8002aa <printfmt>
  800400:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800403:	89 7d 14             	mov    %edi,0x14(%ebp)
  800406:	e9 35 02 00 00       	jmp    800640 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  80040b:	50                   	push   %eax
  80040c:	68 d8 23 80 00       	push   $0x8023d8
  800411:	53                   	push   %ebx
  800412:	56                   	push   %esi
  800413:	e8 92 fe ff ff       	call   8002aa <printfmt>
  800418:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  80041b:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  80041e:	e9 1d 02 00 00       	jmp    800640 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800423:	8b 45 14             	mov    0x14(%ebp),%eax
  800426:	83 c0 04             	add    $0x4,%eax
  800429:	89 45 c8             	mov    %eax,-0x38(%ebp)
  80042c:	8b 45 14             	mov    0x14(%ebp),%eax
  80042f:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800431:	85 d2                	test   %edx,%edx
  800433:	b8 d1 23 80 00       	mov    $0x8023d1,%eax
  800438:	0f 45 c2             	cmovne %edx,%eax
  80043b:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  80043e:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  800442:	7e 06                	jle    80044a <vprintfmt+0x17f>
  800444:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  800448:	75 0d                	jne    800457 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  80044a:	8b 45 cc             	mov    -0x34(%ebp),%eax
  80044d:	89 c7                	mov    %eax,%edi
  80044f:	03 45 d4             	add    -0x2c(%ebp),%eax
  800452:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  800455:	eb 55                	jmp    8004ac <vprintfmt+0x1e1>
  800457:	83 ec 08             	sub    $0x8,%esp
  80045a:	ff 75 d8             	pushl  -0x28(%ebp)
  80045d:	ff 75 cc             	pushl  -0x34(%ebp)
  800460:	e8 15 03 00 00       	call   80077a <strnlen>
  800465:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800468:	29 c2                	sub    %eax,%edx
  80046a:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  80046d:	83 c4 10             	add    $0x10,%esp
  800470:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  800472:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  800476:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  800479:	85 ff                	test   %edi,%edi
  80047b:	7e 11                	jle    80048e <vprintfmt+0x1c3>
					putch(padc, putdat);
  80047d:	83 ec 08             	sub    $0x8,%esp
  800480:	53                   	push   %ebx
  800481:	ff 75 d4             	pushl  -0x2c(%ebp)
  800484:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  800486:	83 ef 01             	sub    $0x1,%edi
  800489:	83 c4 10             	add    $0x10,%esp
  80048c:	eb eb                	jmp    800479 <vprintfmt+0x1ae>
  80048e:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  800491:	85 d2                	test   %edx,%edx
  800493:	b8 00 00 00 00       	mov    $0x0,%eax
  800498:	0f 49 c2             	cmovns %edx,%eax
  80049b:	29 c2                	sub    %eax,%edx
  80049d:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  8004a0:	eb a8                	jmp    80044a <vprintfmt+0x17f>
					putch(ch, putdat);
  8004a2:	83 ec 08             	sub    $0x8,%esp
  8004a5:	53                   	push   %ebx
  8004a6:	52                   	push   %edx
  8004a7:	ff d6                	call   *%esi
  8004a9:	83 c4 10             	add    $0x10,%esp
  8004ac:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  8004af:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  8004b1:	83 c7 01             	add    $0x1,%edi
  8004b4:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8004b8:	0f be d0             	movsbl %al,%edx
  8004bb:	85 d2                	test   %edx,%edx
  8004bd:	74 4b                	je     80050a <vprintfmt+0x23f>
  8004bf:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  8004c3:	78 06                	js     8004cb <vprintfmt+0x200>
  8004c5:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  8004c9:	78 1e                	js     8004e9 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  8004cb:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  8004cf:	74 d1                	je     8004a2 <vprintfmt+0x1d7>
  8004d1:	0f be c0             	movsbl %al,%eax
  8004d4:	83 e8 20             	sub    $0x20,%eax
  8004d7:	83 f8 5e             	cmp    $0x5e,%eax
  8004da:	76 c6                	jbe    8004a2 <vprintfmt+0x1d7>
					putch('?', putdat);
  8004dc:	83 ec 08             	sub    $0x8,%esp
  8004df:	53                   	push   %ebx
  8004e0:	6a 3f                	push   $0x3f
  8004e2:	ff d6                	call   *%esi
  8004e4:	83 c4 10             	add    $0x10,%esp
  8004e7:	eb c3                	jmp    8004ac <vprintfmt+0x1e1>
  8004e9:	89 cf                	mov    %ecx,%edi
  8004eb:	eb 0e                	jmp    8004fb <vprintfmt+0x230>
				putch(' ', putdat);
  8004ed:	83 ec 08             	sub    $0x8,%esp
  8004f0:	53                   	push   %ebx
  8004f1:	6a 20                	push   $0x20
  8004f3:	ff d6                	call   *%esi
			for (; width > 0; width--)
  8004f5:	83 ef 01             	sub    $0x1,%edi
  8004f8:	83 c4 10             	add    $0x10,%esp
  8004fb:	85 ff                	test   %edi,%edi
  8004fd:	7f ee                	jg     8004ed <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  8004ff:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800502:	89 45 14             	mov    %eax,0x14(%ebp)
  800505:	e9 36 01 00 00       	jmp    800640 <vprintfmt+0x375>
  80050a:	89 cf                	mov    %ecx,%edi
  80050c:	eb ed                	jmp    8004fb <vprintfmt+0x230>
	if (lflag >= 2)
  80050e:	83 f9 01             	cmp    $0x1,%ecx
  800511:	7f 1f                	jg     800532 <vprintfmt+0x267>
	else if (lflag)
  800513:	85 c9                	test   %ecx,%ecx
  800515:	74 67                	je     80057e <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  800517:	8b 45 14             	mov    0x14(%ebp),%eax
  80051a:	8b 00                	mov    (%eax),%eax
  80051c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80051f:	89 c1                	mov    %eax,%ecx
  800521:	c1 f9 1f             	sar    $0x1f,%ecx
  800524:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800527:	8b 45 14             	mov    0x14(%ebp),%eax
  80052a:	8d 40 04             	lea    0x4(%eax),%eax
  80052d:	89 45 14             	mov    %eax,0x14(%ebp)
  800530:	eb 17                	jmp    800549 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800532:	8b 45 14             	mov    0x14(%ebp),%eax
  800535:	8b 50 04             	mov    0x4(%eax),%edx
  800538:	8b 00                	mov    (%eax),%eax
  80053a:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80053d:	89 55 dc             	mov    %edx,-0x24(%ebp)
  800540:	8b 45 14             	mov    0x14(%ebp),%eax
  800543:	8d 40 08             	lea    0x8(%eax),%eax
  800546:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  800549:	8b 55 d8             	mov    -0x28(%ebp),%edx
  80054c:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  80054f:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  800554:	85 c9                	test   %ecx,%ecx
  800556:	0f 89 ca 00 00 00    	jns    800626 <vprintfmt+0x35b>
				putch('-', putdat);
  80055c:	83 ec 08             	sub    $0x8,%esp
  80055f:	53                   	push   %ebx
  800560:	6a 2d                	push   $0x2d
  800562:	ff d6                	call   *%esi
				num = -(long long) num;
  800564:	8b 55 d8             	mov    -0x28(%ebp),%edx
  800567:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  80056a:	f7 da                	neg    %edx
  80056c:	83 d1 00             	adc    $0x0,%ecx
  80056f:	f7 d9                	neg    %ecx
  800571:	83 c4 10             	add    $0x10,%esp
			base = 10;
  800574:	b8 0a 00 00 00       	mov    $0xa,%eax
  800579:	e9 a8 00 00 00       	jmp    800626 <vprintfmt+0x35b>
		return va_arg(*ap, int);
  80057e:	8b 45 14             	mov    0x14(%ebp),%eax
  800581:	8b 00                	mov    (%eax),%eax
  800583:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800586:	99                   	cltd   
  800587:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80058a:	8b 45 14             	mov    0x14(%ebp),%eax
  80058d:	8d 40 04             	lea    0x4(%eax),%eax
  800590:	89 45 14             	mov    %eax,0x14(%ebp)
  800593:	eb b4                	jmp    800549 <vprintfmt+0x27e>
	if (lflag >= 2)
  800595:	83 f9 01             	cmp    $0x1,%ecx
  800598:	7f 1b                	jg     8005b5 <vprintfmt+0x2ea>
	else if (lflag)
  80059a:	85 c9                	test   %ecx,%ecx
  80059c:	74 2c                	je     8005ca <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  80059e:	8b 45 14             	mov    0x14(%ebp),%eax
  8005a1:	8b 10                	mov    (%eax),%edx
  8005a3:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005a8:	8d 40 04             	lea    0x4(%eax),%eax
  8005ab:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005ae:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  8005b3:	eb 71                	jmp    800626 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8005b5:	8b 45 14             	mov    0x14(%ebp),%eax
  8005b8:	8b 10                	mov    (%eax),%edx
  8005ba:	8b 48 04             	mov    0x4(%eax),%ecx
  8005bd:	8d 40 08             	lea    0x8(%eax),%eax
  8005c0:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005c3:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  8005c8:	eb 5c                	jmp    800626 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  8005ca:	8b 45 14             	mov    0x14(%ebp),%eax
  8005cd:	8b 10                	mov    (%eax),%edx
  8005cf:	b9 00 00 00 00       	mov    $0x0,%ecx
  8005d4:	8d 40 04             	lea    0x4(%eax),%eax
  8005d7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  8005da:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  8005df:	eb 45                	jmp    800626 <vprintfmt+0x35b>
			putch('X', putdat);
  8005e1:	83 ec 08             	sub    $0x8,%esp
  8005e4:	53                   	push   %ebx
  8005e5:	6a 58                	push   $0x58
  8005e7:	ff d6                	call   *%esi
			putch('X', putdat);
  8005e9:	83 c4 08             	add    $0x8,%esp
  8005ec:	53                   	push   %ebx
  8005ed:	6a 58                	push   $0x58
  8005ef:	ff d6                	call   *%esi
			putch('X', putdat);
  8005f1:	83 c4 08             	add    $0x8,%esp
  8005f4:	53                   	push   %ebx
  8005f5:	6a 58                	push   $0x58
  8005f7:	ff d6                	call   *%esi
			break;
  8005f9:	83 c4 10             	add    $0x10,%esp
  8005fc:	eb 42                	jmp    800640 <vprintfmt+0x375>
			putch('0', putdat);
  8005fe:	83 ec 08             	sub    $0x8,%esp
  800601:	53                   	push   %ebx
  800602:	6a 30                	push   $0x30
  800604:	ff d6                	call   *%esi
			putch('x', putdat);
  800606:	83 c4 08             	add    $0x8,%esp
  800609:	53                   	push   %ebx
  80060a:	6a 78                	push   $0x78
  80060c:	ff d6                	call   *%esi
			num = (unsigned long long)
  80060e:	8b 45 14             	mov    0x14(%ebp),%eax
  800611:	8b 10                	mov    (%eax),%edx
  800613:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  800618:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  80061b:	8d 40 04             	lea    0x4(%eax),%eax
  80061e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800621:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  800626:	83 ec 0c             	sub    $0xc,%esp
  800629:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  80062d:	57                   	push   %edi
  80062e:	ff 75 d4             	pushl  -0x2c(%ebp)
  800631:	50                   	push   %eax
  800632:	51                   	push   %ecx
  800633:	52                   	push   %edx
  800634:	89 da                	mov    %ebx,%edx
  800636:	89 f0                	mov    %esi,%eax
  800638:	e8 a3 fb ff ff       	call   8001e0 <printnum>
			break;
  80063d:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  800640:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  800643:	83 c7 01             	add    $0x1,%edi
  800646:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  80064a:	83 f8 25             	cmp    $0x25,%eax
  80064d:	0f 84 93 fc ff ff    	je     8002e6 <vprintfmt+0x1b>
			if (ch == '\0')
  800653:	85 c0                	test   %eax,%eax
  800655:	0f 84 8b 00 00 00    	je     8006e6 <vprintfmt+0x41b>
			putch(ch, putdat);
  80065b:	83 ec 08             	sub    $0x8,%esp
  80065e:	53                   	push   %ebx
  80065f:	50                   	push   %eax
  800660:	ff d6                	call   *%esi
  800662:	83 c4 10             	add    $0x10,%esp
  800665:	eb dc                	jmp    800643 <vprintfmt+0x378>
	if (lflag >= 2)
  800667:	83 f9 01             	cmp    $0x1,%ecx
  80066a:	7f 1b                	jg     800687 <vprintfmt+0x3bc>
	else if (lflag)
  80066c:	85 c9                	test   %ecx,%ecx
  80066e:	74 2c                	je     80069c <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  800670:	8b 45 14             	mov    0x14(%ebp),%eax
  800673:	8b 10                	mov    (%eax),%edx
  800675:	b9 00 00 00 00       	mov    $0x0,%ecx
  80067a:	8d 40 04             	lea    0x4(%eax),%eax
  80067d:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800680:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  800685:	eb 9f                	jmp    800626 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  800687:	8b 45 14             	mov    0x14(%ebp),%eax
  80068a:	8b 10                	mov    (%eax),%edx
  80068c:	8b 48 04             	mov    0x4(%eax),%ecx
  80068f:	8d 40 08             	lea    0x8(%eax),%eax
  800692:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800695:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  80069a:	eb 8a                	jmp    800626 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80069c:	8b 45 14             	mov    0x14(%ebp),%eax
  80069f:	8b 10                	mov    (%eax),%edx
  8006a1:	b9 00 00 00 00       	mov    $0x0,%ecx
  8006a6:	8d 40 04             	lea    0x4(%eax),%eax
  8006a9:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8006ac:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  8006b1:	e9 70 ff ff ff       	jmp    800626 <vprintfmt+0x35b>
			putch(ch, putdat);
  8006b6:	83 ec 08             	sub    $0x8,%esp
  8006b9:	53                   	push   %ebx
  8006ba:	6a 25                	push   $0x25
  8006bc:	ff d6                	call   *%esi
			break;
  8006be:	83 c4 10             	add    $0x10,%esp
  8006c1:	e9 7a ff ff ff       	jmp    800640 <vprintfmt+0x375>
			putch('%', putdat);
  8006c6:	83 ec 08             	sub    $0x8,%esp
  8006c9:	53                   	push   %ebx
  8006ca:	6a 25                	push   $0x25
  8006cc:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  8006ce:	83 c4 10             	add    $0x10,%esp
  8006d1:	89 f8                	mov    %edi,%eax
  8006d3:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  8006d7:	74 05                	je     8006de <vprintfmt+0x413>
  8006d9:	83 e8 01             	sub    $0x1,%eax
  8006dc:	eb f5                	jmp    8006d3 <vprintfmt+0x408>
  8006de:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8006e1:	e9 5a ff ff ff       	jmp    800640 <vprintfmt+0x375>
}
  8006e6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8006e9:	5b                   	pop    %ebx
  8006ea:	5e                   	pop    %esi
  8006eb:	5f                   	pop    %edi
  8006ec:	5d                   	pop    %ebp
  8006ed:	c3                   	ret    

008006ee <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  8006ee:	f3 0f 1e fb          	endbr32 
  8006f2:	55                   	push   %ebp
  8006f3:	89 e5                	mov    %esp,%ebp
  8006f5:	83 ec 18             	sub    $0x18,%esp
  8006f8:	8b 45 08             	mov    0x8(%ebp),%eax
  8006fb:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  8006fe:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800701:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  800705:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  800708:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  80070f:	85 c0                	test   %eax,%eax
  800711:	74 26                	je     800739 <vsnprintf+0x4b>
  800713:	85 d2                	test   %edx,%edx
  800715:	7e 22                	jle    800739 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  800717:	ff 75 14             	pushl  0x14(%ebp)
  80071a:	ff 75 10             	pushl  0x10(%ebp)
  80071d:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800720:	50                   	push   %eax
  800721:	68 89 02 80 00       	push   $0x800289
  800726:	e8 a0 fb ff ff       	call   8002cb <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  80072b:	8b 45 ec             	mov    -0x14(%ebp),%eax
  80072e:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800731:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800734:	83 c4 10             	add    $0x10,%esp
}
  800737:	c9                   	leave  
  800738:	c3                   	ret    
		return -E_INVAL;
  800739:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80073e:	eb f7                	jmp    800737 <vsnprintf+0x49>

00800740 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  800740:	f3 0f 1e fb          	endbr32 
  800744:	55                   	push   %ebp
  800745:	89 e5                	mov    %esp,%ebp
  800747:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  80074a:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  80074d:	50                   	push   %eax
  80074e:	ff 75 10             	pushl  0x10(%ebp)
  800751:	ff 75 0c             	pushl  0xc(%ebp)
  800754:	ff 75 08             	pushl  0x8(%ebp)
  800757:	e8 92 ff ff ff       	call   8006ee <vsnprintf>
	va_end(ap);

	return rc;
}
  80075c:	c9                   	leave  
  80075d:	c3                   	ret    

0080075e <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  80075e:	f3 0f 1e fb          	endbr32 
  800762:	55                   	push   %ebp
  800763:	89 e5                	mov    %esp,%ebp
  800765:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  800768:	b8 00 00 00 00       	mov    $0x0,%eax
  80076d:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  800771:	74 05                	je     800778 <strlen+0x1a>
		n++;
  800773:	83 c0 01             	add    $0x1,%eax
  800776:	eb f5                	jmp    80076d <strlen+0xf>
	return n;
}
  800778:	5d                   	pop    %ebp
  800779:	c3                   	ret    

0080077a <strnlen>:

int
strnlen(const char *s, size_t size)
{
  80077a:	f3 0f 1e fb          	endbr32 
  80077e:	55                   	push   %ebp
  80077f:	89 e5                	mov    %esp,%ebp
  800781:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800784:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  800787:	b8 00 00 00 00       	mov    $0x0,%eax
  80078c:	39 d0                	cmp    %edx,%eax
  80078e:	74 0d                	je     80079d <strnlen+0x23>
  800790:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  800794:	74 05                	je     80079b <strnlen+0x21>
		n++;
  800796:	83 c0 01             	add    $0x1,%eax
  800799:	eb f1                	jmp    80078c <strnlen+0x12>
  80079b:	89 c2                	mov    %eax,%edx
	return n;
}
  80079d:	89 d0                	mov    %edx,%eax
  80079f:	5d                   	pop    %ebp
  8007a0:	c3                   	ret    

008007a1 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  8007a1:	f3 0f 1e fb          	endbr32 
  8007a5:	55                   	push   %ebp
  8007a6:	89 e5                	mov    %esp,%ebp
  8007a8:	53                   	push   %ebx
  8007a9:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8007ac:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  8007af:	b8 00 00 00 00       	mov    $0x0,%eax
  8007b4:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  8007b8:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  8007bb:	83 c0 01             	add    $0x1,%eax
  8007be:	84 d2                	test   %dl,%dl
  8007c0:	75 f2                	jne    8007b4 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  8007c2:	89 c8                	mov    %ecx,%eax
  8007c4:	5b                   	pop    %ebx
  8007c5:	5d                   	pop    %ebp
  8007c6:	c3                   	ret    

008007c7 <strcat>:

char *
strcat(char *dst, const char *src)
{
  8007c7:	f3 0f 1e fb          	endbr32 
  8007cb:	55                   	push   %ebp
  8007cc:	89 e5                	mov    %esp,%ebp
  8007ce:	53                   	push   %ebx
  8007cf:	83 ec 10             	sub    $0x10,%esp
  8007d2:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  8007d5:	53                   	push   %ebx
  8007d6:	e8 83 ff ff ff       	call   80075e <strlen>
  8007db:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  8007de:	ff 75 0c             	pushl  0xc(%ebp)
  8007e1:	01 d8                	add    %ebx,%eax
  8007e3:	50                   	push   %eax
  8007e4:	e8 b8 ff ff ff       	call   8007a1 <strcpy>
	return dst;
}
  8007e9:	89 d8                	mov    %ebx,%eax
  8007eb:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8007ee:	c9                   	leave  
  8007ef:	c3                   	ret    

008007f0 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  8007f0:	f3 0f 1e fb          	endbr32 
  8007f4:	55                   	push   %ebp
  8007f5:	89 e5                	mov    %esp,%ebp
  8007f7:	56                   	push   %esi
  8007f8:	53                   	push   %ebx
  8007f9:	8b 75 08             	mov    0x8(%ebp),%esi
  8007fc:	8b 55 0c             	mov    0xc(%ebp),%edx
  8007ff:	89 f3                	mov    %esi,%ebx
  800801:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800804:	89 f0                	mov    %esi,%eax
  800806:	39 d8                	cmp    %ebx,%eax
  800808:	74 11                	je     80081b <strncpy+0x2b>
		*dst++ = *src;
  80080a:	83 c0 01             	add    $0x1,%eax
  80080d:	0f b6 0a             	movzbl (%edx),%ecx
  800810:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800813:	80 f9 01             	cmp    $0x1,%cl
  800816:	83 da ff             	sbb    $0xffffffff,%edx
  800819:	eb eb                	jmp    800806 <strncpy+0x16>
	}
	return ret;
}
  80081b:	89 f0                	mov    %esi,%eax
  80081d:	5b                   	pop    %ebx
  80081e:	5e                   	pop    %esi
  80081f:	5d                   	pop    %ebp
  800820:	c3                   	ret    

00800821 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800821:	f3 0f 1e fb          	endbr32 
  800825:	55                   	push   %ebp
  800826:	89 e5                	mov    %esp,%ebp
  800828:	56                   	push   %esi
  800829:	53                   	push   %ebx
  80082a:	8b 75 08             	mov    0x8(%ebp),%esi
  80082d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800830:	8b 55 10             	mov    0x10(%ebp),%edx
  800833:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  800835:	85 d2                	test   %edx,%edx
  800837:	74 21                	je     80085a <strlcpy+0x39>
  800839:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  80083d:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  80083f:	39 c2                	cmp    %eax,%edx
  800841:	74 14                	je     800857 <strlcpy+0x36>
  800843:	0f b6 19             	movzbl (%ecx),%ebx
  800846:	84 db                	test   %bl,%bl
  800848:	74 0b                	je     800855 <strlcpy+0x34>
			*dst++ = *src++;
  80084a:	83 c1 01             	add    $0x1,%ecx
  80084d:	83 c2 01             	add    $0x1,%edx
  800850:	88 5a ff             	mov    %bl,-0x1(%edx)
  800853:	eb ea                	jmp    80083f <strlcpy+0x1e>
  800855:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  800857:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  80085a:	29 f0                	sub    %esi,%eax
}
  80085c:	5b                   	pop    %ebx
  80085d:	5e                   	pop    %esi
  80085e:	5d                   	pop    %ebp
  80085f:	c3                   	ret    

00800860 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  800860:	f3 0f 1e fb          	endbr32 
  800864:	55                   	push   %ebp
  800865:	89 e5                	mov    %esp,%ebp
  800867:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80086a:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  80086d:	0f b6 01             	movzbl (%ecx),%eax
  800870:	84 c0                	test   %al,%al
  800872:	74 0c                	je     800880 <strcmp+0x20>
  800874:	3a 02                	cmp    (%edx),%al
  800876:	75 08                	jne    800880 <strcmp+0x20>
		p++, q++;
  800878:	83 c1 01             	add    $0x1,%ecx
  80087b:	83 c2 01             	add    $0x1,%edx
  80087e:	eb ed                	jmp    80086d <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  800880:	0f b6 c0             	movzbl %al,%eax
  800883:	0f b6 12             	movzbl (%edx),%edx
  800886:	29 d0                	sub    %edx,%eax
}
  800888:	5d                   	pop    %ebp
  800889:	c3                   	ret    

0080088a <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  80088a:	f3 0f 1e fb          	endbr32 
  80088e:	55                   	push   %ebp
  80088f:	89 e5                	mov    %esp,%ebp
  800891:	53                   	push   %ebx
  800892:	8b 45 08             	mov    0x8(%ebp),%eax
  800895:	8b 55 0c             	mov    0xc(%ebp),%edx
  800898:	89 c3                	mov    %eax,%ebx
  80089a:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  80089d:	eb 06                	jmp    8008a5 <strncmp+0x1b>
		n--, p++, q++;
  80089f:	83 c0 01             	add    $0x1,%eax
  8008a2:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  8008a5:	39 d8                	cmp    %ebx,%eax
  8008a7:	74 16                	je     8008bf <strncmp+0x35>
  8008a9:	0f b6 08             	movzbl (%eax),%ecx
  8008ac:	84 c9                	test   %cl,%cl
  8008ae:	74 04                	je     8008b4 <strncmp+0x2a>
  8008b0:	3a 0a                	cmp    (%edx),%cl
  8008b2:	74 eb                	je     80089f <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  8008b4:	0f b6 00             	movzbl (%eax),%eax
  8008b7:	0f b6 12             	movzbl (%edx),%edx
  8008ba:	29 d0                	sub    %edx,%eax
}
  8008bc:	5b                   	pop    %ebx
  8008bd:	5d                   	pop    %ebp
  8008be:	c3                   	ret    
		return 0;
  8008bf:	b8 00 00 00 00       	mov    $0x0,%eax
  8008c4:	eb f6                	jmp    8008bc <strncmp+0x32>

008008c6 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  8008c6:	f3 0f 1e fb          	endbr32 
  8008ca:	55                   	push   %ebp
  8008cb:	89 e5                	mov    %esp,%ebp
  8008cd:	8b 45 08             	mov    0x8(%ebp),%eax
  8008d0:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008d4:	0f b6 10             	movzbl (%eax),%edx
  8008d7:	84 d2                	test   %dl,%dl
  8008d9:	74 09                	je     8008e4 <strchr+0x1e>
		if (*s == c)
  8008db:	38 ca                	cmp    %cl,%dl
  8008dd:	74 0a                	je     8008e9 <strchr+0x23>
	for (; *s; s++)
  8008df:	83 c0 01             	add    $0x1,%eax
  8008e2:	eb f0                	jmp    8008d4 <strchr+0xe>
			return (char *) s;
	return 0;
  8008e4:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8008e9:	5d                   	pop    %ebp
  8008ea:	c3                   	ret    

008008eb <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  8008eb:	f3 0f 1e fb          	endbr32 
  8008ef:	55                   	push   %ebp
  8008f0:	89 e5                	mov    %esp,%ebp
  8008f2:	8b 45 08             	mov    0x8(%ebp),%eax
  8008f5:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  8008f9:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  8008fc:	38 ca                	cmp    %cl,%dl
  8008fe:	74 09                	je     800909 <strfind+0x1e>
  800900:	84 d2                	test   %dl,%dl
  800902:	74 05                	je     800909 <strfind+0x1e>
	for (; *s; s++)
  800904:	83 c0 01             	add    $0x1,%eax
  800907:	eb f0                	jmp    8008f9 <strfind+0xe>
			break;
	return (char *) s;
}
  800909:	5d                   	pop    %ebp
  80090a:	c3                   	ret    

0080090b <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  80090b:	f3 0f 1e fb          	endbr32 
  80090f:	55                   	push   %ebp
  800910:	89 e5                	mov    %esp,%ebp
  800912:	57                   	push   %edi
  800913:	56                   	push   %esi
  800914:	53                   	push   %ebx
  800915:	8b 7d 08             	mov    0x8(%ebp),%edi
  800918:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  80091b:	85 c9                	test   %ecx,%ecx
  80091d:	74 31                	je     800950 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  80091f:	89 f8                	mov    %edi,%eax
  800921:	09 c8                	or     %ecx,%eax
  800923:	a8 03                	test   $0x3,%al
  800925:	75 23                	jne    80094a <memset+0x3f>
		c &= 0xFF;
  800927:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  80092b:	89 d3                	mov    %edx,%ebx
  80092d:	c1 e3 08             	shl    $0x8,%ebx
  800930:	89 d0                	mov    %edx,%eax
  800932:	c1 e0 18             	shl    $0x18,%eax
  800935:	89 d6                	mov    %edx,%esi
  800937:	c1 e6 10             	shl    $0x10,%esi
  80093a:	09 f0                	or     %esi,%eax
  80093c:	09 c2                	or     %eax,%edx
  80093e:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800940:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800943:	89 d0                	mov    %edx,%eax
  800945:	fc                   	cld    
  800946:	f3 ab                	rep stos %eax,%es:(%edi)
  800948:	eb 06                	jmp    800950 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  80094a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80094d:	fc                   	cld    
  80094e:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800950:	89 f8                	mov    %edi,%eax
  800952:	5b                   	pop    %ebx
  800953:	5e                   	pop    %esi
  800954:	5f                   	pop    %edi
  800955:	5d                   	pop    %ebp
  800956:	c3                   	ret    

00800957 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800957:	f3 0f 1e fb          	endbr32 
  80095b:	55                   	push   %ebp
  80095c:	89 e5                	mov    %esp,%ebp
  80095e:	57                   	push   %edi
  80095f:	56                   	push   %esi
  800960:	8b 45 08             	mov    0x8(%ebp),%eax
  800963:	8b 75 0c             	mov    0xc(%ebp),%esi
  800966:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800969:	39 c6                	cmp    %eax,%esi
  80096b:	73 32                	jae    80099f <memmove+0x48>
  80096d:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800970:	39 c2                	cmp    %eax,%edx
  800972:	76 2b                	jbe    80099f <memmove+0x48>
		s += n;
		d += n;
  800974:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800977:	89 fe                	mov    %edi,%esi
  800979:	09 ce                	or     %ecx,%esi
  80097b:	09 d6                	or     %edx,%esi
  80097d:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800983:	75 0e                	jne    800993 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800985:	83 ef 04             	sub    $0x4,%edi
  800988:	8d 72 fc             	lea    -0x4(%edx),%esi
  80098b:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  80098e:	fd                   	std    
  80098f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800991:	eb 09                	jmp    80099c <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800993:	83 ef 01             	sub    $0x1,%edi
  800996:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800999:	fd                   	std    
  80099a:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  80099c:	fc                   	cld    
  80099d:	eb 1a                	jmp    8009b9 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  80099f:	89 c2                	mov    %eax,%edx
  8009a1:	09 ca                	or     %ecx,%edx
  8009a3:	09 f2                	or     %esi,%edx
  8009a5:	f6 c2 03             	test   $0x3,%dl
  8009a8:	75 0a                	jne    8009b4 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  8009aa:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  8009ad:	89 c7                	mov    %eax,%edi
  8009af:	fc                   	cld    
  8009b0:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8009b2:	eb 05                	jmp    8009b9 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  8009b4:	89 c7                	mov    %eax,%edi
  8009b6:	fc                   	cld    
  8009b7:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  8009b9:	5e                   	pop    %esi
  8009ba:	5f                   	pop    %edi
  8009bb:	5d                   	pop    %ebp
  8009bc:	c3                   	ret    

008009bd <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  8009bd:	f3 0f 1e fb          	endbr32 
  8009c1:	55                   	push   %ebp
  8009c2:	89 e5                	mov    %esp,%ebp
  8009c4:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  8009c7:	ff 75 10             	pushl  0x10(%ebp)
  8009ca:	ff 75 0c             	pushl  0xc(%ebp)
  8009cd:	ff 75 08             	pushl  0x8(%ebp)
  8009d0:	e8 82 ff ff ff       	call   800957 <memmove>
}
  8009d5:	c9                   	leave  
  8009d6:	c3                   	ret    

008009d7 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  8009d7:	f3 0f 1e fb          	endbr32 
  8009db:	55                   	push   %ebp
  8009dc:	89 e5                	mov    %esp,%ebp
  8009de:	56                   	push   %esi
  8009df:	53                   	push   %ebx
  8009e0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009e3:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009e6:	89 c6                	mov    %eax,%esi
  8009e8:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  8009eb:	39 f0                	cmp    %esi,%eax
  8009ed:	74 1c                	je     800a0b <memcmp+0x34>
		if (*s1 != *s2)
  8009ef:	0f b6 08             	movzbl (%eax),%ecx
  8009f2:	0f b6 1a             	movzbl (%edx),%ebx
  8009f5:	38 d9                	cmp    %bl,%cl
  8009f7:	75 08                	jne    800a01 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  8009f9:	83 c0 01             	add    $0x1,%eax
  8009fc:	83 c2 01             	add    $0x1,%edx
  8009ff:	eb ea                	jmp    8009eb <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800a01:	0f b6 c1             	movzbl %cl,%eax
  800a04:	0f b6 db             	movzbl %bl,%ebx
  800a07:	29 d8                	sub    %ebx,%eax
  800a09:	eb 05                	jmp    800a10 <memcmp+0x39>
	}

	return 0;
  800a0b:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a10:	5b                   	pop    %ebx
  800a11:	5e                   	pop    %esi
  800a12:	5d                   	pop    %ebp
  800a13:	c3                   	ret    

00800a14 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800a14:	f3 0f 1e fb          	endbr32 
  800a18:	55                   	push   %ebp
  800a19:	89 e5                	mov    %esp,%ebp
  800a1b:	8b 45 08             	mov    0x8(%ebp),%eax
  800a1e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800a21:	89 c2                	mov    %eax,%edx
  800a23:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800a26:	39 d0                	cmp    %edx,%eax
  800a28:	73 09                	jae    800a33 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800a2a:	38 08                	cmp    %cl,(%eax)
  800a2c:	74 05                	je     800a33 <memfind+0x1f>
	for (; s < ends; s++)
  800a2e:	83 c0 01             	add    $0x1,%eax
  800a31:	eb f3                	jmp    800a26 <memfind+0x12>
			break;
	return (void *) s;
}
  800a33:	5d                   	pop    %ebp
  800a34:	c3                   	ret    

00800a35 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800a35:	f3 0f 1e fb          	endbr32 
  800a39:	55                   	push   %ebp
  800a3a:	89 e5                	mov    %esp,%ebp
  800a3c:	57                   	push   %edi
  800a3d:	56                   	push   %esi
  800a3e:	53                   	push   %ebx
  800a3f:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800a42:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800a45:	eb 03                	jmp    800a4a <strtol+0x15>
		s++;
  800a47:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800a4a:	0f b6 01             	movzbl (%ecx),%eax
  800a4d:	3c 20                	cmp    $0x20,%al
  800a4f:	74 f6                	je     800a47 <strtol+0x12>
  800a51:	3c 09                	cmp    $0x9,%al
  800a53:	74 f2                	je     800a47 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800a55:	3c 2b                	cmp    $0x2b,%al
  800a57:	74 2a                	je     800a83 <strtol+0x4e>
	int neg = 0;
  800a59:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800a5e:	3c 2d                	cmp    $0x2d,%al
  800a60:	74 2b                	je     800a8d <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a62:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800a68:	75 0f                	jne    800a79 <strtol+0x44>
  800a6a:	80 39 30             	cmpb   $0x30,(%ecx)
  800a6d:	74 28                	je     800a97 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800a6f:	85 db                	test   %ebx,%ebx
  800a71:	b8 0a 00 00 00       	mov    $0xa,%eax
  800a76:	0f 44 d8             	cmove  %eax,%ebx
  800a79:	b8 00 00 00 00       	mov    $0x0,%eax
  800a7e:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800a81:	eb 46                	jmp    800ac9 <strtol+0x94>
		s++;
  800a83:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800a86:	bf 00 00 00 00       	mov    $0x0,%edi
  800a8b:	eb d5                	jmp    800a62 <strtol+0x2d>
		s++, neg = 1;
  800a8d:	83 c1 01             	add    $0x1,%ecx
  800a90:	bf 01 00 00 00       	mov    $0x1,%edi
  800a95:	eb cb                	jmp    800a62 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800a97:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800a9b:	74 0e                	je     800aab <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800a9d:	85 db                	test   %ebx,%ebx
  800a9f:	75 d8                	jne    800a79 <strtol+0x44>
		s++, base = 8;
  800aa1:	83 c1 01             	add    $0x1,%ecx
  800aa4:	bb 08 00 00 00       	mov    $0x8,%ebx
  800aa9:	eb ce                	jmp    800a79 <strtol+0x44>
		s += 2, base = 16;
  800aab:	83 c1 02             	add    $0x2,%ecx
  800aae:	bb 10 00 00 00       	mov    $0x10,%ebx
  800ab3:	eb c4                	jmp    800a79 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800ab5:	0f be d2             	movsbl %dl,%edx
  800ab8:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800abb:	3b 55 10             	cmp    0x10(%ebp),%edx
  800abe:	7d 3a                	jge    800afa <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800ac0:	83 c1 01             	add    $0x1,%ecx
  800ac3:	0f af 45 10          	imul   0x10(%ebp),%eax
  800ac7:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800ac9:	0f b6 11             	movzbl (%ecx),%edx
  800acc:	8d 72 d0             	lea    -0x30(%edx),%esi
  800acf:	89 f3                	mov    %esi,%ebx
  800ad1:	80 fb 09             	cmp    $0x9,%bl
  800ad4:	76 df                	jbe    800ab5 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800ad6:	8d 72 9f             	lea    -0x61(%edx),%esi
  800ad9:	89 f3                	mov    %esi,%ebx
  800adb:	80 fb 19             	cmp    $0x19,%bl
  800ade:	77 08                	ja     800ae8 <strtol+0xb3>
			dig = *s - 'a' + 10;
  800ae0:	0f be d2             	movsbl %dl,%edx
  800ae3:	83 ea 57             	sub    $0x57,%edx
  800ae6:	eb d3                	jmp    800abb <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800ae8:	8d 72 bf             	lea    -0x41(%edx),%esi
  800aeb:	89 f3                	mov    %esi,%ebx
  800aed:	80 fb 19             	cmp    $0x19,%bl
  800af0:	77 08                	ja     800afa <strtol+0xc5>
			dig = *s - 'A' + 10;
  800af2:	0f be d2             	movsbl %dl,%edx
  800af5:	83 ea 37             	sub    $0x37,%edx
  800af8:	eb c1                	jmp    800abb <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800afa:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800afe:	74 05                	je     800b05 <strtol+0xd0>
		*endptr = (char *) s;
  800b00:	8b 75 0c             	mov    0xc(%ebp),%esi
  800b03:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800b05:	89 c2                	mov    %eax,%edx
  800b07:	f7 da                	neg    %edx
  800b09:	85 ff                	test   %edi,%edi
  800b0b:	0f 45 c2             	cmovne %edx,%eax
}
  800b0e:	5b                   	pop    %ebx
  800b0f:	5e                   	pop    %esi
  800b10:	5f                   	pop    %edi
  800b11:	5d                   	pop    %ebp
  800b12:	c3                   	ret    

00800b13 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800b13:	f3 0f 1e fb          	endbr32 
  800b17:	55                   	push   %ebp
  800b18:	89 e5                	mov    %esp,%ebp
  800b1a:	57                   	push   %edi
  800b1b:	56                   	push   %esi
  800b1c:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b1d:	b8 00 00 00 00       	mov    $0x0,%eax
  800b22:	8b 55 08             	mov    0x8(%ebp),%edx
  800b25:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800b28:	89 c3                	mov    %eax,%ebx
  800b2a:	89 c7                	mov    %eax,%edi
  800b2c:	89 c6                	mov    %eax,%esi
  800b2e:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800b30:	5b                   	pop    %ebx
  800b31:	5e                   	pop    %esi
  800b32:	5f                   	pop    %edi
  800b33:	5d                   	pop    %ebp
  800b34:	c3                   	ret    

00800b35 <sys_cgetc>:

int
sys_cgetc(void)
{
  800b35:	f3 0f 1e fb          	endbr32 
  800b39:	55                   	push   %ebp
  800b3a:	89 e5                	mov    %esp,%ebp
  800b3c:	57                   	push   %edi
  800b3d:	56                   	push   %esi
  800b3e:	53                   	push   %ebx
	asm volatile("int %1\n"
  800b3f:	ba 00 00 00 00       	mov    $0x0,%edx
  800b44:	b8 01 00 00 00       	mov    $0x1,%eax
  800b49:	89 d1                	mov    %edx,%ecx
  800b4b:	89 d3                	mov    %edx,%ebx
  800b4d:	89 d7                	mov    %edx,%edi
  800b4f:	89 d6                	mov    %edx,%esi
  800b51:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800b53:	5b                   	pop    %ebx
  800b54:	5e                   	pop    %esi
  800b55:	5f                   	pop    %edi
  800b56:	5d                   	pop    %ebp
  800b57:	c3                   	ret    

00800b58 <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800b58:	f3 0f 1e fb          	endbr32 
  800b5c:	55                   	push   %ebp
  800b5d:	89 e5                	mov    %esp,%ebp
  800b5f:	57                   	push   %edi
  800b60:	56                   	push   %esi
  800b61:	53                   	push   %ebx
  800b62:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800b65:	b9 00 00 00 00       	mov    $0x0,%ecx
  800b6a:	8b 55 08             	mov    0x8(%ebp),%edx
  800b6d:	b8 03 00 00 00       	mov    $0x3,%eax
  800b72:	89 cb                	mov    %ecx,%ebx
  800b74:	89 cf                	mov    %ecx,%edi
  800b76:	89 ce                	mov    %ecx,%esi
  800b78:	cd 30                	int    $0x30
	if(check && ret > 0)
  800b7a:	85 c0                	test   %eax,%eax
  800b7c:	7f 08                	jg     800b86 <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800b7e:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800b81:	5b                   	pop    %ebx
  800b82:	5e                   	pop    %esi
  800b83:	5f                   	pop    %edi
  800b84:	5d                   	pop    %ebp
  800b85:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800b86:	83 ec 0c             	sub    $0xc,%esp
  800b89:	50                   	push   %eax
  800b8a:	6a 03                	push   $0x3
  800b8c:	68 bf 26 80 00       	push   $0x8026bf
  800b91:	6a 23                	push   $0x23
  800b93:	68 dc 26 80 00       	push   $0x8026dc
  800b98:	e8 dd 12 00 00       	call   801e7a <_panic>

00800b9d <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800b9d:	f3 0f 1e fb          	endbr32 
  800ba1:	55                   	push   %ebp
  800ba2:	89 e5                	mov    %esp,%ebp
  800ba4:	57                   	push   %edi
  800ba5:	56                   	push   %esi
  800ba6:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ba7:	ba 00 00 00 00       	mov    $0x0,%edx
  800bac:	b8 02 00 00 00       	mov    $0x2,%eax
  800bb1:	89 d1                	mov    %edx,%ecx
  800bb3:	89 d3                	mov    %edx,%ebx
  800bb5:	89 d7                	mov    %edx,%edi
  800bb7:	89 d6                	mov    %edx,%esi
  800bb9:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800bbb:	5b                   	pop    %ebx
  800bbc:	5e                   	pop    %esi
  800bbd:	5f                   	pop    %edi
  800bbe:	5d                   	pop    %ebp
  800bbf:	c3                   	ret    

00800bc0 <sys_yield>:

void
sys_yield(void)
{
  800bc0:	f3 0f 1e fb          	endbr32 
  800bc4:	55                   	push   %ebp
  800bc5:	89 e5                	mov    %esp,%ebp
  800bc7:	57                   	push   %edi
  800bc8:	56                   	push   %esi
  800bc9:	53                   	push   %ebx
	asm volatile("int %1\n"
  800bca:	ba 00 00 00 00       	mov    $0x0,%edx
  800bcf:	b8 0b 00 00 00       	mov    $0xb,%eax
  800bd4:	89 d1                	mov    %edx,%ecx
  800bd6:	89 d3                	mov    %edx,%ebx
  800bd8:	89 d7                	mov    %edx,%edi
  800bda:	89 d6                	mov    %edx,%esi
  800bdc:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800bde:	5b                   	pop    %ebx
  800bdf:	5e                   	pop    %esi
  800be0:	5f                   	pop    %edi
  800be1:	5d                   	pop    %ebp
  800be2:	c3                   	ret    

00800be3 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800be3:	f3 0f 1e fb          	endbr32 
  800be7:	55                   	push   %ebp
  800be8:	89 e5                	mov    %esp,%ebp
  800bea:	57                   	push   %edi
  800beb:	56                   	push   %esi
  800bec:	53                   	push   %ebx
  800bed:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800bf0:	be 00 00 00 00       	mov    $0x0,%esi
  800bf5:	8b 55 08             	mov    0x8(%ebp),%edx
  800bf8:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800bfb:	b8 04 00 00 00       	mov    $0x4,%eax
  800c00:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c03:	89 f7                	mov    %esi,%edi
  800c05:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c07:	85 c0                	test   %eax,%eax
  800c09:	7f 08                	jg     800c13 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800c0b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c0e:	5b                   	pop    %ebx
  800c0f:	5e                   	pop    %esi
  800c10:	5f                   	pop    %edi
  800c11:	5d                   	pop    %ebp
  800c12:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c13:	83 ec 0c             	sub    $0xc,%esp
  800c16:	50                   	push   %eax
  800c17:	6a 04                	push   $0x4
  800c19:	68 bf 26 80 00       	push   $0x8026bf
  800c1e:	6a 23                	push   $0x23
  800c20:	68 dc 26 80 00       	push   $0x8026dc
  800c25:	e8 50 12 00 00       	call   801e7a <_panic>

00800c2a <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800c2a:	f3 0f 1e fb          	endbr32 
  800c2e:	55                   	push   %ebp
  800c2f:	89 e5                	mov    %esp,%ebp
  800c31:	57                   	push   %edi
  800c32:	56                   	push   %esi
  800c33:	53                   	push   %ebx
  800c34:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c37:	8b 55 08             	mov    0x8(%ebp),%edx
  800c3a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c3d:	b8 05 00 00 00       	mov    $0x5,%eax
  800c42:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800c45:	8b 7d 14             	mov    0x14(%ebp),%edi
  800c48:	8b 75 18             	mov    0x18(%ebp),%esi
  800c4b:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c4d:	85 c0                	test   %eax,%eax
  800c4f:	7f 08                	jg     800c59 <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800c51:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c54:	5b                   	pop    %ebx
  800c55:	5e                   	pop    %esi
  800c56:	5f                   	pop    %edi
  800c57:	5d                   	pop    %ebp
  800c58:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c59:	83 ec 0c             	sub    $0xc,%esp
  800c5c:	50                   	push   %eax
  800c5d:	6a 05                	push   $0x5
  800c5f:	68 bf 26 80 00       	push   $0x8026bf
  800c64:	6a 23                	push   $0x23
  800c66:	68 dc 26 80 00       	push   $0x8026dc
  800c6b:	e8 0a 12 00 00       	call   801e7a <_panic>

00800c70 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800c70:	f3 0f 1e fb          	endbr32 
  800c74:	55                   	push   %ebp
  800c75:	89 e5                	mov    %esp,%ebp
  800c77:	57                   	push   %edi
  800c78:	56                   	push   %esi
  800c79:	53                   	push   %ebx
  800c7a:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800c7d:	bb 00 00 00 00       	mov    $0x0,%ebx
  800c82:	8b 55 08             	mov    0x8(%ebp),%edx
  800c85:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c88:	b8 06 00 00 00       	mov    $0x6,%eax
  800c8d:	89 df                	mov    %ebx,%edi
  800c8f:	89 de                	mov    %ebx,%esi
  800c91:	cd 30                	int    $0x30
	if(check && ret > 0)
  800c93:	85 c0                	test   %eax,%eax
  800c95:	7f 08                	jg     800c9f <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800c97:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800c9a:	5b                   	pop    %ebx
  800c9b:	5e                   	pop    %esi
  800c9c:	5f                   	pop    %edi
  800c9d:	5d                   	pop    %ebp
  800c9e:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800c9f:	83 ec 0c             	sub    $0xc,%esp
  800ca2:	50                   	push   %eax
  800ca3:	6a 06                	push   $0x6
  800ca5:	68 bf 26 80 00       	push   $0x8026bf
  800caa:	6a 23                	push   $0x23
  800cac:	68 dc 26 80 00       	push   $0x8026dc
  800cb1:	e8 c4 11 00 00       	call   801e7a <_panic>

00800cb6 <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800cb6:	f3 0f 1e fb          	endbr32 
  800cba:	55                   	push   %ebp
  800cbb:	89 e5                	mov    %esp,%ebp
  800cbd:	57                   	push   %edi
  800cbe:	56                   	push   %esi
  800cbf:	53                   	push   %ebx
  800cc0:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cc3:	bb 00 00 00 00       	mov    $0x0,%ebx
  800cc8:	8b 55 08             	mov    0x8(%ebp),%edx
  800ccb:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800cce:	b8 08 00 00 00       	mov    $0x8,%eax
  800cd3:	89 df                	mov    %ebx,%edi
  800cd5:	89 de                	mov    %ebx,%esi
  800cd7:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cd9:	85 c0                	test   %eax,%eax
  800cdb:	7f 08                	jg     800ce5 <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800cdd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce0:	5b                   	pop    %ebx
  800ce1:	5e                   	pop    %esi
  800ce2:	5f                   	pop    %edi
  800ce3:	5d                   	pop    %ebp
  800ce4:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ce5:	83 ec 0c             	sub    $0xc,%esp
  800ce8:	50                   	push   %eax
  800ce9:	6a 08                	push   $0x8
  800ceb:	68 bf 26 80 00       	push   $0x8026bf
  800cf0:	6a 23                	push   $0x23
  800cf2:	68 dc 26 80 00       	push   $0x8026dc
  800cf7:	e8 7e 11 00 00       	call   801e7a <_panic>

00800cfc <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800cfc:	f3 0f 1e fb          	endbr32 
  800d00:	55                   	push   %ebp
  800d01:	89 e5                	mov    %esp,%ebp
  800d03:	57                   	push   %edi
  800d04:	56                   	push   %esi
  800d05:	53                   	push   %ebx
  800d06:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d09:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d0e:	8b 55 08             	mov    0x8(%ebp),%edx
  800d11:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d14:	b8 09 00 00 00       	mov    $0x9,%eax
  800d19:	89 df                	mov    %ebx,%edi
  800d1b:	89 de                	mov    %ebx,%esi
  800d1d:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d1f:	85 c0                	test   %eax,%eax
  800d21:	7f 08                	jg     800d2b <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800d23:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d26:	5b                   	pop    %ebx
  800d27:	5e                   	pop    %esi
  800d28:	5f                   	pop    %edi
  800d29:	5d                   	pop    %ebp
  800d2a:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d2b:	83 ec 0c             	sub    $0xc,%esp
  800d2e:	50                   	push   %eax
  800d2f:	6a 09                	push   $0x9
  800d31:	68 bf 26 80 00       	push   $0x8026bf
  800d36:	6a 23                	push   $0x23
  800d38:	68 dc 26 80 00       	push   $0x8026dc
  800d3d:	e8 38 11 00 00       	call   801e7a <_panic>

00800d42 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800d42:	f3 0f 1e fb          	endbr32 
  800d46:	55                   	push   %ebp
  800d47:	89 e5                	mov    %esp,%ebp
  800d49:	57                   	push   %edi
  800d4a:	56                   	push   %esi
  800d4b:	53                   	push   %ebx
  800d4c:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d4f:	bb 00 00 00 00       	mov    $0x0,%ebx
  800d54:	8b 55 08             	mov    0x8(%ebp),%edx
  800d57:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d5a:	b8 0a 00 00 00       	mov    $0xa,%eax
  800d5f:	89 df                	mov    %ebx,%edi
  800d61:	89 de                	mov    %ebx,%esi
  800d63:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d65:	85 c0                	test   %eax,%eax
  800d67:	7f 08                	jg     800d71 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800d69:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d6c:	5b                   	pop    %ebx
  800d6d:	5e                   	pop    %esi
  800d6e:	5f                   	pop    %edi
  800d6f:	5d                   	pop    %ebp
  800d70:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d71:	83 ec 0c             	sub    $0xc,%esp
  800d74:	50                   	push   %eax
  800d75:	6a 0a                	push   $0xa
  800d77:	68 bf 26 80 00       	push   $0x8026bf
  800d7c:	6a 23                	push   $0x23
  800d7e:	68 dc 26 80 00       	push   $0x8026dc
  800d83:	e8 f2 10 00 00       	call   801e7a <_panic>

00800d88 <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800d88:	f3 0f 1e fb          	endbr32 
  800d8c:	55                   	push   %ebp
  800d8d:	89 e5                	mov    %esp,%ebp
  800d8f:	57                   	push   %edi
  800d90:	56                   	push   %esi
  800d91:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d92:	8b 55 08             	mov    0x8(%ebp),%edx
  800d95:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d98:	b8 0c 00 00 00       	mov    $0xc,%eax
  800d9d:	be 00 00 00 00       	mov    $0x0,%esi
  800da2:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800da5:	8b 7d 14             	mov    0x14(%ebp),%edi
  800da8:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800daa:	5b                   	pop    %ebx
  800dab:	5e                   	pop    %esi
  800dac:	5f                   	pop    %edi
  800dad:	5d                   	pop    %ebp
  800dae:	c3                   	ret    

00800daf <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800daf:	f3 0f 1e fb          	endbr32 
  800db3:	55                   	push   %ebp
  800db4:	89 e5                	mov    %esp,%ebp
  800db6:	57                   	push   %edi
  800db7:	56                   	push   %esi
  800db8:	53                   	push   %ebx
  800db9:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800dbc:	b9 00 00 00 00       	mov    $0x0,%ecx
  800dc1:	8b 55 08             	mov    0x8(%ebp),%edx
  800dc4:	b8 0d 00 00 00       	mov    $0xd,%eax
  800dc9:	89 cb                	mov    %ecx,%ebx
  800dcb:	89 cf                	mov    %ecx,%edi
  800dcd:	89 ce                	mov    %ecx,%esi
  800dcf:	cd 30                	int    $0x30
	if(check && ret > 0)
  800dd1:	85 c0                	test   %eax,%eax
  800dd3:	7f 08                	jg     800ddd <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800dd5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dd8:	5b                   	pop    %ebx
  800dd9:	5e                   	pop    %esi
  800dda:	5f                   	pop    %edi
  800ddb:	5d                   	pop    %ebp
  800ddc:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ddd:	83 ec 0c             	sub    $0xc,%esp
  800de0:	50                   	push   %eax
  800de1:	6a 0d                	push   $0xd
  800de3:	68 bf 26 80 00       	push   $0x8026bf
  800de8:	6a 23                	push   $0x23
  800dea:	68 dc 26 80 00       	push   $0x8026dc
  800def:	e8 86 10 00 00       	call   801e7a <_panic>

00800df4 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800df4:	f3 0f 1e fb          	endbr32 
  800df8:	55                   	push   %ebp
  800df9:	89 e5                	mov    %esp,%ebp
  800dfb:	56                   	push   %esi
  800dfc:	53                   	push   %ebx
  800dfd:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800e00:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e02:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800e06:	0f 84 b2 00 00 00    	je     800ebe <pgfault+0xca>
  800e0c:	89 d8                	mov    %ebx,%eax
  800e0e:	c1 e8 16             	shr    $0x16,%eax
  800e11:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800e18:	a8 01                	test   $0x1,%al
  800e1a:	0f 84 9e 00 00 00    	je     800ebe <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e20:	89 d8                	mov    %ebx,%eax
  800e22:	c1 e8 0c             	shr    $0xc,%eax
  800e25:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e2c:	f6 c2 01             	test   $0x1,%dl
  800e2f:	0f 84 89 00 00 00    	je     800ebe <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800e35:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800e3c:	f6 c4 08             	test   $0x8,%ah
  800e3f:	74 7d                	je     800ebe <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800e41:	e8 57 fd ff ff       	call   800b9d <sys_getenvid>
  800e46:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800e48:	83 ec 04             	sub    $0x4,%esp
  800e4b:	6a 07                	push   $0x7
  800e4d:	68 00 f0 7f 00       	push   $0x7ff000
  800e52:	50                   	push   %eax
  800e53:	e8 8b fd ff ff       	call   800be3 <sys_page_alloc>
	if(r<0){
  800e58:	83 c4 10             	add    $0x10,%esp
  800e5b:	85 c0                	test   %eax,%eax
  800e5d:	78 73                	js     800ed2 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800e5f:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800e65:	83 ec 04             	sub    $0x4,%esp
  800e68:	68 00 10 00 00       	push   $0x1000
  800e6d:	53                   	push   %ebx
  800e6e:	68 00 f0 7f 00       	push   $0x7ff000
  800e73:	e8 df fa ff ff       	call   800957 <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800e78:	83 c4 08             	add    $0x8,%esp
  800e7b:	53                   	push   %ebx
  800e7c:	56                   	push   %esi
  800e7d:	e8 ee fd ff ff       	call   800c70 <sys_page_unmap>
	if(r<0)
  800e82:	83 c4 10             	add    $0x10,%esp
  800e85:	85 c0                	test   %eax,%eax
  800e87:	78 5b                	js     800ee4 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800e89:	83 ec 0c             	sub    $0xc,%esp
  800e8c:	6a 07                	push   $0x7
  800e8e:	53                   	push   %ebx
  800e8f:	56                   	push   %esi
  800e90:	68 00 f0 7f 00       	push   $0x7ff000
  800e95:	56                   	push   %esi
  800e96:	e8 8f fd ff ff       	call   800c2a <sys_page_map>
	if(r<0)
  800e9b:	83 c4 20             	add    $0x20,%esp
  800e9e:	85 c0                	test   %eax,%eax
  800ea0:	78 54                	js     800ef6 <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  800ea2:	83 ec 08             	sub    $0x8,%esp
  800ea5:	68 00 f0 7f 00       	push   $0x7ff000
  800eaa:	56                   	push   %esi
  800eab:	e8 c0 fd ff ff       	call   800c70 <sys_page_unmap>
	if(r<0)
  800eb0:	83 c4 10             	add    $0x10,%esp
  800eb3:	85 c0                	test   %eax,%eax
  800eb5:	78 51                	js     800f08 <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  800eb7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800eba:	5b                   	pop    %ebx
  800ebb:	5e                   	pop    %esi
  800ebc:	5d                   	pop    %ebp
  800ebd:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  800ebe:	83 ec 04             	sub    $0x4,%esp
  800ec1:	68 ec 26 80 00       	push   $0x8026ec
  800ec6:	6a 2c                	push   $0x2c
  800ec8:	68 9b 27 80 00       	push   $0x80279b
  800ecd:	e8 a8 0f 00 00       	call   801e7a <_panic>
		 panic("pgfault: page allocation failed %e", r);
  800ed2:	50                   	push   %eax
  800ed3:	68 2c 27 80 00       	push   $0x80272c
  800ed8:	6a 31                	push   $0x31
  800eda:	68 9b 27 80 00       	push   $0x80279b
  800edf:	e8 96 0f 00 00       	call   801e7a <_panic>
	panic("pgfault: page unmap failed %e", r);
  800ee4:	50                   	push   %eax
  800ee5:	68 a6 27 80 00       	push   $0x8027a6
  800eea:	6a 3b                	push   $0x3b
  800eec:	68 9b 27 80 00       	push   $0x80279b
  800ef1:	e8 84 0f 00 00       	call   801e7a <_panic>
	panic("pgfault: page map failed %e", r);
  800ef6:	50                   	push   %eax
  800ef7:	68 c4 27 80 00       	push   $0x8027c4
  800efc:	6a 3e                	push   $0x3e
  800efe:	68 9b 27 80 00       	push   $0x80279b
  800f03:	e8 72 0f 00 00       	call   801e7a <_panic>
	panic("pgfault: page unmap failed %e", r);
  800f08:	50                   	push   %eax
  800f09:	68 a6 27 80 00       	push   $0x8027a6
  800f0e:	6a 41                	push   $0x41
  800f10:	68 9b 27 80 00       	push   $0x80279b
  800f15:	e8 60 0f 00 00       	call   801e7a <_panic>

00800f1a <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  800f1a:	f3 0f 1e fb          	endbr32 
  800f1e:	55                   	push   %ebp
  800f1f:	89 e5                	mov    %esp,%ebp
  800f21:	57                   	push   %edi
  800f22:	56                   	push   %esi
  800f23:	53                   	push   %ebx
  800f24:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  800f27:	68 f4 0d 80 00       	push   $0x800df4
  800f2c:	e8 93 0f 00 00       	call   801ec4 <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  800f31:	b8 07 00 00 00       	mov    $0x7,%eax
  800f36:	cd 30                	int    $0x30
  800f38:	89 c7                	mov    %eax,%edi
  800f3a:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  800f3d:	83 c4 10             	add    $0x10,%esp
  800f40:	85 c0                	test   %eax,%eax
  800f42:	0f 8e 9d 01 00 00    	jle    8010e5 <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800f48:	bb 00 00 80 00       	mov    $0x800000,%ebx
  800f4d:	eb 5b                	jmp    800faa <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  800f4f:	83 ec 0c             	sub    $0xc,%esp
  800f52:	68 07 0e 00 00       	push   $0xe07
  800f57:	56                   	push   %esi
  800f58:	ff 75 e4             	pushl  -0x1c(%ebp)
  800f5b:	56                   	push   %esi
  800f5c:	6a 00                	push   $0x0
  800f5e:	e8 c7 fc ff ff       	call   800c2a <sys_page_map>
  800f63:	83 c4 20             	add    $0x20,%esp
  800f66:	eb 30                	jmp    800f98 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  800f68:	83 ec 04             	sub    $0x4,%esp
  800f6b:	68 e0 27 80 00       	push   $0x8027e0
  800f70:	6a 63                	push   $0x63
  800f72:	68 9b 27 80 00       	push   $0x80279b
  800f77:	e8 fe 0e 00 00       	call   801e7a <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  800f7c:	83 ec 0c             	sub    $0xc,%esp
  800f7f:	6a 05                	push   $0x5
  800f81:	56                   	push   %esi
  800f82:	ff 75 e4             	pushl  -0x1c(%ebp)
  800f85:	56                   	push   %esi
  800f86:	6a 00                	push   $0x0
  800f88:	e8 9d fc ff ff       	call   800c2a <sys_page_map>
            if(r < 0)
  800f8d:	83 c4 20             	add    $0x20,%esp
  800f90:	85 c0                	test   %eax,%eax
  800f92:	0f 88 ac 00 00 00    	js     801044 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  800f98:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  800f9e:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  800fa4:	0f 84 ae 00 00 00    	je     801058 <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800faa:	89 d8                	mov    %ebx,%eax
  800fac:	c1 e8 16             	shr    $0x16,%eax
  800faf:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800fb6:	a8 01                	test   $0x1,%al
  800fb8:	74 de                	je     800f98 <fork+0x7e>
			pn=PGNUM(pageVa);
  800fba:	89 d8                	mov    %ebx,%eax
  800fbc:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  800fbf:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  800fc6:	f6 c2 01             	test   $0x1,%dl
  800fc9:	74 cd                	je     800f98 <fork+0x7e>
  800fcb:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  800fd2:	f6 c2 04             	test   $0x4,%dl
  800fd5:	74 c1                	je     800f98 <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  800fd7:	89 c6                	mov    %eax,%esi
  800fd9:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  800fdc:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  800fe3:	f6 c4 04             	test   $0x4,%ah
  800fe6:	0f 85 63 ff ff ff    	jne    800f4f <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  800fec:	a9 02 08 00 00       	test   $0x802,%eax
  800ff1:	74 89                	je     800f7c <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  800ff3:	83 ec 0c             	sub    $0xc,%esp
  800ff6:	68 05 08 00 00       	push   $0x805
  800ffb:	56                   	push   %esi
  800ffc:	ff 75 e4             	pushl  -0x1c(%ebp)
  800fff:	56                   	push   %esi
  801000:	6a 00                	push   $0x0
  801002:	e8 23 fc ff ff       	call   800c2a <sys_page_map>
            if(r < 0)
  801007:	83 c4 20             	add    $0x20,%esp
  80100a:	85 c0                	test   %eax,%eax
  80100c:	0f 88 56 ff ff ff    	js     800f68 <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801012:	83 ec 0c             	sub    $0xc,%esp
  801015:	68 05 08 00 00       	push   $0x805
  80101a:	56                   	push   %esi
  80101b:	6a 00                	push   $0x0
  80101d:	56                   	push   %esi
  80101e:	6a 00                	push   $0x0
  801020:	e8 05 fc ff ff       	call   800c2a <sys_page_map>
            if(r < 0)
  801025:	83 c4 20             	add    $0x20,%esp
  801028:	85 c0                	test   %eax,%eax
  80102a:	0f 89 68 ff ff ff    	jns    800f98 <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  801030:	83 ec 04             	sub    $0x4,%esp
  801033:	68 e0 27 80 00       	push   $0x8027e0
  801038:	6a 66                	push   $0x66
  80103a:	68 9b 27 80 00       	push   $0x80279b
  80103f:	e8 36 0e 00 00       	call   801e7a <_panic>
                panic("duppage: sys_page_map fail\n");
  801044:	83 ec 04             	sub    $0x4,%esp
  801047:	68 e0 27 80 00       	push   $0x8027e0
  80104c:	6a 6c                	push   $0x6c
  80104e:	68 9b 27 80 00       	push   $0x80279b
  801053:	e8 22 0e 00 00       	call   801e7a <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  801058:	83 ec 04             	sub    $0x4,%esp
  80105b:	6a 07                	push   $0x7
  80105d:	68 00 f0 bf ee       	push   $0xeebff000
  801062:	57                   	push   %edi
  801063:	e8 7b fb ff ff       	call   800be3 <sys_page_alloc>
		if(flag<0){
  801068:	83 c4 10             	add    $0x10,%esp
  80106b:	85 c0                	test   %eax,%eax
  80106d:	78 31                	js     8010a0 <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  80106f:	83 ec 08             	sub    $0x8,%esp
  801072:	68 3e 1f 80 00       	push   $0x801f3e
  801077:	57                   	push   %edi
  801078:	e8 c5 fc ff ff       	call   800d42 <sys_env_set_pgfault_upcall>
		if(flag<0){
  80107d:	83 c4 10             	add    $0x10,%esp
  801080:	85 c0                	test   %eax,%eax
  801082:	78 33                	js     8010b7 <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  801084:	83 ec 08             	sub    $0x8,%esp
  801087:	6a 02                	push   $0x2
  801089:	57                   	push   %edi
  80108a:	e8 27 fc ff ff       	call   800cb6 <sys_env_set_status>
		if(flag<0){
  80108f:	83 c4 10             	add    $0x10,%esp
  801092:	85 c0                	test   %eax,%eax
  801094:	78 38                	js     8010ce <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  801096:	89 f8                	mov    %edi,%eax
  801098:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80109b:	5b                   	pop    %ebx
  80109c:	5e                   	pop    %esi
  80109d:	5f                   	pop    %edi
  80109e:	5d                   	pop    %ebp
  80109f:	c3                   	ret    
			panic("panic by alloc page");
  8010a0:	83 ec 04             	sub    $0x4,%esp
  8010a3:	68 fc 27 80 00       	push   $0x8027fc
  8010a8:	68 98 00 00 00       	push   $0x98
  8010ad:	68 9b 27 80 00       	push   $0x80279b
  8010b2:	e8 c3 0d 00 00       	call   801e7a <_panic>
			panic("panic by set pgfault upcall faction");
  8010b7:	83 ec 04             	sub    $0x4,%esp
  8010ba:	68 50 27 80 00       	push   $0x802750
  8010bf:	68 9e 00 00 00       	push   $0x9e
  8010c4:	68 9b 27 80 00       	push   $0x80279b
  8010c9:	e8 ac 0d 00 00       	call   801e7a <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  8010ce:	83 ec 04             	sub    $0x4,%esp
  8010d1:	68 74 27 80 00       	push   $0x802774
  8010d6:	68 a3 00 00 00       	push   $0xa3
  8010db:	68 9b 27 80 00       	push   $0x80279b
  8010e0:	e8 95 0d 00 00       	call   801e7a <_panic>
	else if(envid==0){
  8010e5:	75 19                	jne    801100 <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  8010e7:	e8 b1 fa ff ff       	call   800b9d <sys_getenvid>
  8010ec:	25 ff 03 00 00       	and    $0x3ff,%eax
  8010f1:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8010f4:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8010f9:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  8010fe:	eb 96                	jmp    801096 <fork+0x17c>
		panic("panic by alloc envid");
  801100:	83 ec 04             	sub    $0x4,%esp
  801103:	68 10 28 80 00       	push   $0x802810
  801108:	68 ad 00 00 00       	push   $0xad
  80110d:	68 9b 27 80 00       	push   $0x80279b
  801112:	e8 63 0d 00 00       	call   801e7a <_panic>

00801117 <sfork>:

// Challenge!
int
sfork(void)
{
  801117:	f3 0f 1e fb          	endbr32 
  80111b:	55                   	push   %ebp
  80111c:	89 e5                	mov    %esp,%ebp
  80111e:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801121:	68 25 28 80 00       	push   $0x802825
  801126:	68 b7 00 00 00       	push   $0xb7
  80112b:	68 9b 27 80 00       	push   $0x80279b
  801130:	e8 45 0d 00 00       	call   801e7a <_panic>

00801135 <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  801135:	f3 0f 1e fb          	endbr32 
  801139:	55                   	push   %ebp
  80113a:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80113c:	8b 45 08             	mov    0x8(%ebp),%eax
  80113f:	05 00 00 00 30       	add    $0x30000000,%eax
  801144:	c1 e8 0c             	shr    $0xc,%eax
}
  801147:	5d                   	pop    %ebp
  801148:	c3                   	ret    

00801149 <fd2data>:

char*
fd2data(struct Fd *fd)
{
  801149:	f3 0f 1e fb          	endbr32 
  80114d:	55                   	push   %ebp
  80114e:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  801150:	8b 45 08             	mov    0x8(%ebp),%eax
  801153:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  801158:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  80115d:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  801162:	5d                   	pop    %ebp
  801163:	c3                   	ret    

00801164 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  801164:	f3 0f 1e fb          	endbr32 
  801168:	55                   	push   %ebp
  801169:	89 e5                	mov    %esp,%ebp
  80116b:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  801170:	89 c2                	mov    %eax,%edx
  801172:	c1 ea 16             	shr    $0x16,%edx
  801175:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  80117c:	f6 c2 01             	test   $0x1,%dl
  80117f:	74 2d                	je     8011ae <fd_alloc+0x4a>
  801181:	89 c2                	mov    %eax,%edx
  801183:	c1 ea 0c             	shr    $0xc,%edx
  801186:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80118d:	f6 c2 01             	test   $0x1,%dl
  801190:	74 1c                	je     8011ae <fd_alloc+0x4a>
  801192:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  801197:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  80119c:	75 d2                	jne    801170 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  80119e:	8b 45 08             	mov    0x8(%ebp),%eax
  8011a1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  8011a7:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  8011ac:	eb 0a                	jmp    8011b8 <fd_alloc+0x54>
			*fd_store = fd;
  8011ae:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8011b1:	89 01                	mov    %eax,(%ecx)
			return 0;
  8011b3:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8011b8:	5d                   	pop    %ebp
  8011b9:	c3                   	ret    

008011ba <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  8011ba:	f3 0f 1e fb          	endbr32 
  8011be:	55                   	push   %ebp
  8011bf:	89 e5                	mov    %esp,%ebp
  8011c1:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  8011c4:	83 f8 1f             	cmp    $0x1f,%eax
  8011c7:	77 30                	ja     8011f9 <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  8011c9:	c1 e0 0c             	shl    $0xc,%eax
  8011cc:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  8011d1:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  8011d7:	f6 c2 01             	test   $0x1,%dl
  8011da:	74 24                	je     801200 <fd_lookup+0x46>
  8011dc:	89 c2                	mov    %eax,%edx
  8011de:	c1 ea 0c             	shr    $0xc,%edx
  8011e1:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8011e8:	f6 c2 01             	test   $0x1,%dl
  8011eb:	74 1a                	je     801207 <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  8011ed:	8b 55 0c             	mov    0xc(%ebp),%edx
  8011f0:	89 02                	mov    %eax,(%edx)
	return 0;
  8011f2:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8011f7:	5d                   	pop    %ebp
  8011f8:	c3                   	ret    
		return -E_INVAL;
  8011f9:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8011fe:	eb f7                	jmp    8011f7 <fd_lookup+0x3d>
		return -E_INVAL;
  801200:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801205:	eb f0                	jmp    8011f7 <fd_lookup+0x3d>
  801207:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80120c:	eb e9                	jmp    8011f7 <fd_lookup+0x3d>

0080120e <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  80120e:	f3 0f 1e fb          	endbr32 
  801212:	55                   	push   %ebp
  801213:	89 e5                	mov    %esp,%ebp
  801215:	83 ec 08             	sub    $0x8,%esp
  801218:	8b 4d 08             	mov    0x8(%ebp),%ecx
  80121b:	ba b8 28 80 00       	mov    $0x8028b8,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801220:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  801225:	39 08                	cmp    %ecx,(%eax)
  801227:	74 33                	je     80125c <dev_lookup+0x4e>
  801229:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  80122c:	8b 02                	mov    (%edx),%eax
  80122e:	85 c0                	test   %eax,%eax
  801230:	75 f3                	jne    801225 <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801232:	a1 04 40 80 00       	mov    0x804004,%eax
  801237:	8b 40 48             	mov    0x48(%eax),%eax
  80123a:	83 ec 04             	sub    $0x4,%esp
  80123d:	51                   	push   %ecx
  80123e:	50                   	push   %eax
  80123f:	68 3c 28 80 00       	push   $0x80283c
  801244:	e8 7f ef ff ff       	call   8001c8 <cprintf>
	*dev = 0;
  801249:	8b 45 0c             	mov    0xc(%ebp),%eax
  80124c:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  801252:	83 c4 10             	add    $0x10,%esp
  801255:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  80125a:	c9                   	leave  
  80125b:	c3                   	ret    
			*dev = devtab[i];
  80125c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  80125f:	89 01                	mov    %eax,(%ecx)
			return 0;
  801261:	b8 00 00 00 00       	mov    $0x0,%eax
  801266:	eb f2                	jmp    80125a <dev_lookup+0x4c>

00801268 <fd_close>:
{
  801268:	f3 0f 1e fb          	endbr32 
  80126c:	55                   	push   %ebp
  80126d:	89 e5                	mov    %esp,%ebp
  80126f:	57                   	push   %edi
  801270:	56                   	push   %esi
  801271:	53                   	push   %ebx
  801272:	83 ec 24             	sub    $0x24,%esp
  801275:	8b 75 08             	mov    0x8(%ebp),%esi
  801278:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  80127b:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80127e:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  80127f:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  801285:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  801288:	50                   	push   %eax
  801289:	e8 2c ff ff ff       	call   8011ba <fd_lookup>
  80128e:	89 c3                	mov    %eax,%ebx
  801290:	83 c4 10             	add    $0x10,%esp
  801293:	85 c0                	test   %eax,%eax
  801295:	78 05                	js     80129c <fd_close+0x34>
	    || fd != fd2)
  801297:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  80129a:	74 16                	je     8012b2 <fd_close+0x4a>
		return (must_exist ? r : 0);
  80129c:	89 f8                	mov    %edi,%eax
  80129e:	84 c0                	test   %al,%al
  8012a0:	b8 00 00 00 00       	mov    $0x0,%eax
  8012a5:	0f 44 d8             	cmove  %eax,%ebx
}
  8012a8:	89 d8                	mov    %ebx,%eax
  8012aa:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8012ad:	5b                   	pop    %ebx
  8012ae:	5e                   	pop    %esi
  8012af:	5f                   	pop    %edi
  8012b0:	5d                   	pop    %ebp
  8012b1:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  8012b2:	83 ec 08             	sub    $0x8,%esp
  8012b5:	8d 45 e0             	lea    -0x20(%ebp),%eax
  8012b8:	50                   	push   %eax
  8012b9:	ff 36                	pushl  (%esi)
  8012bb:	e8 4e ff ff ff       	call   80120e <dev_lookup>
  8012c0:	89 c3                	mov    %eax,%ebx
  8012c2:	83 c4 10             	add    $0x10,%esp
  8012c5:	85 c0                	test   %eax,%eax
  8012c7:	78 1a                	js     8012e3 <fd_close+0x7b>
		if (dev->dev_close)
  8012c9:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8012cc:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  8012cf:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  8012d4:	85 c0                	test   %eax,%eax
  8012d6:	74 0b                	je     8012e3 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  8012d8:	83 ec 0c             	sub    $0xc,%esp
  8012db:	56                   	push   %esi
  8012dc:	ff d0                	call   *%eax
  8012de:	89 c3                	mov    %eax,%ebx
  8012e0:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  8012e3:	83 ec 08             	sub    $0x8,%esp
  8012e6:	56                   	push   %esi
  8012e7:	6a 00                	push   $0x0
  8012e9:	e8 82 f9 ff ff       	call   800c70 <sys_page_unmap>
	return r;
  8012ee:	83 c4 10             	add    $0x10,%esp
  8012f1:	eb b5                	jmp    8012a8 <fd_close+0x40>

008012f3 <close>:

int
close(int fdnum)
{
  8012f3:	f3 0f 1e fb          	endbr32 
  8012f7:	55                   	push   %ebp
  8012f8:	89 e5                	mov    %esp,%ebp
  8012fa:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8012fd:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801300:	50                   	push   %eax
  801301:	ff 75 08             	pushl  0x8(%ebp)
  801304:	e8 b1 fe ff ff       	call   8011ba <fd_lookup>
  801309:	83 c4 10             	add    $0x10,%esp
  80130c:	85 c0                	test   %eax,%eax
  80130e:	79 02                	jns    801312 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801310:	c9                   	leave  
  801311:	c3                   	ret    
		return fd_close(fd, 1);
  801312:	83 ec 08             	sub    $0x8,%esp
  801315:	6a 01                	push   $0x1
  801317:	ff 75 f4             	pushl  -0xc(%ebp)
  80131a:	e8 49 ff ff ff       	call   801268 <fd_close>
  80131f:	83 c4 10             	add    $0x10,%esp
  801322:	eb ec                	jmp    801310 <close+0x1d>

00801324 <close_all>:

void
close_all(void)
{
  801324:	f3 0f 1e fb          	endbr32 
  801328:	55                   	push   %ebp
  801329:	89 e5                	mov    %esp,%ebp
  80132b:	53                   	push   %ebx
  80132c:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  80132f:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801334:	83 ec 0c             	sub    $0xc,%esp
  801337:	53                   	push   %ebx
  801338:	e8 b6 ff ff ff       	call   8012f3 <close>
	for (i = 0; i < MAXFD; i++)
  80133d:	83 c3 01             	add    $0x1,%ebx
  801340:	83 c4 10             	add    $0x10,%esp
  801343:	83 fb 20             	cmp    $0x20,%ebx
  801346:	75 ec                	jne    801334 <close_all+0x10>
}
  801348:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80134b:	c9                   	leave  
  80134c:	c3                   	ret    

0080134d <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  80134d:	f3 0f 1e fb          	endbr32 
  801351:	55                   	push   %ebp
  801352:	89 e5                	mov    %esp,%ebp
  801354:	57                   	push   %edi
  801355:	56                   	push   %esi
  801356:	53                   	push   %ebx
  801357:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  80135a:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  80135d:	50                   	push   %eax
  80135e:	ff 75 08             	pushl  0x8(%ebp)
  801361:	e8 54 fe ff ff       	call   8011ba <fd_lookup>
  801366:	89 c3                	mov    %eax,%ebx
  801368:	83 c4 10             	add    $0x10,%esp
  80136b:	85 c0                	test   %eax,%eax
  80136d:	0f 88 81 00 00 00    	js     8013f4 <dup+0xa7>
		return r;
	close(newfdnum);
  801373:	83 ec 0c             	sub    $0xc,%esp
  801376:	ff 75 0c             	pushl  0xc(%ebp)
  801379:	e8 75 ff ff ff       	call   8012f3 <close>

	newfd = INDEX2FD(newfdnum);
  80137e:	8b 75 0c             	mov    0xc(%ebp),%esi
  801381:	c1 e6 0c             	shl    $0xc,%esi
  801384:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  80138a:	83 c4 04             	add    $0x4,%esp
  80138d:	ff 75 e4             	pushl  -0x1c(%ebp)
  801390:	e8 b4 fd ff ff       	call   801149 <fd2data>
  801395:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  801397:	89 34 24             	mov    %esi,(%esp)
  80139a:	e8 aa fd ff ff       	call   801149 <fd2data>
  80139f:	83 c4 10             	add    $0x10,%esp
  8013a2:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  8013a4:	89 d8                	mov    %ebx,%eax
  8013a6:	c1 e8 16             	shr    $0x16,%eax
  8013a9:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  8013b0:	a8 01                	test   $0x1,%al
  8013b2:	74 11                	je     8013c5 <dup+0x78>
  8013b4:	89 d8                	mov    %ebx,%eax
  8013b6:	c1 e8 0c             	shr    $0xc,%eax
  8013b9:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  8013c0:	f6 c2 01             	test   $0x1,%dl
  8013c3:	75 39                	jne    8013fe <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  8013c5:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8013c8:	89 d0                	mov    %edx,%eax
  8013ca:	c1 e8 0c             	shr    $0xc,%eax
  8013cd:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  8013d4:	83 ec 0c             	sub    $0xc,%esp
  8013d7:	25 07 0e 00 00       	and    $0xe07,%eax
  8013dc:	50                   	push   %eax
  8013dd:	56                   	push   %esi
  8013de:	6a 00                	push   $0x0
  8013e0:	52                   	push   %edx
  8013e1:	6a 00                	push   $0x0
  8013e3:	e8 42 f8 ff ff       	call   800c2a <sys_page_map>
  8013e8:	89 c3                	mov    %eax,%ebx
  8013ea:	83 c4 20             	add    $0x20,%esp
  8013ed:	85 c0                	test   %eax,%eax
  8013ef:	78 31                	js     801422 <dup+0xd5>
		goto err;

	return newfdnum;
  8013f1:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  8013f4:	89 d8                	mov    %ebx,%eax
  8013f6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8013f9:	5b                   	pop    %ebx
  8013fa:	5e                   	pop    %esi
  8013fb:	5f                   	pop    %edi
  8013fc:	5d                   	pop    %ebp
  8013fd:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  8013fe:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801405:	83 ec 0c             	sub    $0xc,%esp
  801408:	25 07 0e 00 00       	and    $0xe07,%eax
  80140d:	50                   	push   %eax
  80140e:	57                   	push   %edi
  80140f:	6a 00                	push   $0x0
  801411:	53                   	push   %ebx
  801412:	6a 00                	push   $0x0
  801414:	e8 11 f8 ff ff       	call   800c2a <sys_page_map>
  801419:	89 c3                	mov    %eax,%ebx
  80141b:	83 c4 20             	add    $0x20,%esp
  80141e:	85 c0                	test   %eax,%eax
  801420:	79 a3                	jns    8013c5 <dup+0x78>
	sys_page_unmap(0, newfd);
  801422:	83 ec 08             	sub    $0x8,%esp
  801425:	56                   	push   %esi
  801426:	6a 00                	push   $0x0
  801428:	e8 43 f8 ff ff       	call   800c70 <sys_page_unmap>
	sys_page_unmap(0, nva);
  80142d:	83 c4 08             	add    $0x8,%esp
  801430:	57                   	push   %edi
  801431:	6a 00                	push   $0x0
  801433:	e8 38 f8 ff ff       	call   800c70 <sys_page_unmap>
	return r;
  801438:	83 c4 10             	add    $0x10,%esp
  80143b:	eb b7                	jmp    8013f4 <dup+0xa7>

0080143d <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  80143d:	f3 0f 1e fb          	endbr32 
  801441:	55                   	push   %ebp
  801442:	89 e5                	mov    %esp,%ebp
  801444:	53                   	push   %ebx
  801445:	83 ec 1c             	sub    $0x1c,%esp
  801448:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  80144b:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80144e:	50                   	push   %eax
  80144f:	53                   	push   %ebx
  801450:	e8 65 fd ff ff       	call   8011ba <fd_lookup>
  801455:	83 c4 10             	add    $0x10,%esp
  801458:	85 c0                	test   %eax,%eax
  80145a:	78 3f                	js     80149b <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80145c:	83 ec 08             	sub    $0x8,%esp
  80145f:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801462:	50                   	push   %eax
  801463:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801466:	ff 30                	pushl  (%eax)
  801468:	e8 a1 fd ff ff       	call   80120e <dev_lookup>
  80146d:	83 c4 10             	add    $0x10,%esp
  801470:	85 c0                	test   %eax,%eax
  801472:	78 27                	js     80149b <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  801474:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801477:	8b 42 08             	mov    0x8(%edx),%eax
  80147a:	83 e0 03             	and    $0x3,%eax
  80147d:	83 f8 01             	cmp    $0x1,%eax
  801480:	74 1e                	je     8014a0 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  801482:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801485:	8b 40 08             	mov    0x8(%eax),%eax
  801488:	85 c0                	test   %eax,%eax
  80148a:	74 35                	je     8014c1 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  80148c:	83 ec 04             	sub    $0x4,%esp
  80148f:	ff 75 10             	pushl  0x10(%ebp)
  801492:	ff 75 0c             	pushl  0xc(%ebp)
  801495:	52                   	push   %edx
  801496:	ff d0                	call   *%eax
  801498:	83 c4 10             	add    $0x10,%esp
}
  80149b:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80149e:	c9                   	leave  
  80149f:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  8014a0:	a1 04 40 80 00       	mov    0x804004,%eax
  8014a5:	8b 40 48             	mov    0x48(%eax),%eax
  8014a8:	83 ec 04             	sub    $0x4,%esp
  8014ab:	53                   	push   %ebx
  8014ac:	50                   	push   %eax
  8014ad:	68 7d 28 80 00       	push   $0x80287d
  8014b2:	e8 11 ed ff ff       	call   8001c8 <cprintf>
		return -E_INVAL;
  8014b7:	83 c4 10             	add    $0x10,%esp
  8014ba:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8014bf:	eb da                	jmp    80149b <read+0x5e>
		return -E_NOT_SUPP;
  8014c1:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8014c6:	eb d3                	jmp    80149b <read+0x5e>

008014c8 <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  8014c8:	f3 0f 1e fb          	endbr32 
  8014cc:	55                   	push   %ebp
  8014cd:	89 e5                	mov    %esp,%ebp
  8014cf:	57                   	push   %edi
  8014d0:	56                   	push   %esi
  8014d1:	53                   	push   %ebx
  8014d2:	83 ec 0c             	sub    $0xc,%esp
  8014d5:	8b 7d 08             	mov    0x8(%ebp),%edi
  8014d8:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  8014db:	bb 00 00 00 00       	mov    $0x0,%ebx
  8014e0:	eb 02                	jmp    8014e4 <readn+0x1c>
  8014e2:	01 c3                	add    %eax,%ebx
  8014e4:	39 f3                	cmp    %esi,%ebx
  8014e6:	73 21                	jae    801509 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  8014e8:	83 ec 04             	sub    $0x4,%esp
  8014eb:	89 f0                	mov    %esi,%eax
  8014ed:	29 d8                	sub    %ebx,%eax
  8014ef:	50                   	push   %eax
  8014f0:	89 d8                	mov    %ebx,%eax
  8014f2:	03 45 0c             	add    0xc(%ebp),%eax
  8014f5:	50                   	push   %eax
  8014f6:	57                   	push   %edi
  8014f7:	e8 41 ff ff ff       	call   80143d <read>
		if (m < 0)
  8014fc:	83 c4 10             	add    $0x10,%esp
  8014ff:	85 c0                	test   %eax,%eax
  801501:	78 04                	js     801507 <readn+0x3f>
			return m;
		if (m == 0)
  801503:	75 dd                	jne    8014e2 <readn+0x1a>
  801505:	eb 02                	jmp    801509 <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  801507:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  801509:	89 d8                	mov    %ebx,%eax
  80150b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80150e:	5b                   	pop    %ebx
  80150f:	5e                   	pop    %esi
  801510:	5f                   	pop    %edi
  801511:	5d                   	pop    %ebp
  801512:	c3                   	ret    

00801513 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801513:	f3 0f 1e fb          	endbr32 
  801517:	55                   	push   %ebp
  801518:	89 e5                	mov    %esp,%ebp
  80151a:	53                   	push   %ebx
  80151b:	83 ec 1c             	sub    $0x1c,%esp
  80151e:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801521:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801524:	50                   	push   %eax
  801525:	53                   	push   %ebx
  801526:	e8 8f fc ff ff       	call   8011ba <fd_lookup>
  80152b:	83 c4 10             	add    $0x10,%esp
  80152e:	85 c0                	test   %eax,%eax
  801530:	78 3a                	js     80156c <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801532:	83 ec 08             	sub    $0x8,%esp
  801535:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801538:	50                   	push   %eax
  801539:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80153c:	ff 30                	pushl  (%eax)
  80153e:	e8 cb fc ff ff       	call   80120e <dev_lookup>
  801543:	83 c4 10             	add    $0x10,%esp
  801546:	85 c0                	test   %eax,%eax
  801548:	78 22                	js     80156c <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  80154a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80154d:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801551:	74 1e                	je     801571 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  801553:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801556:	8b 52 0c             	mov    0xc(%edx),%edx
  801559:	85 d2                	test   %edx,%edx
  80155b:	74 35                	je     801592 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  80155d:	83 ec 04             	sub    $0x4,%esp
  801560:	ff 75 10             	pushl  0x10(%ebp)
  801563:	ff 75 0c             	pushl  0xc(%ebp)
  801566:	50                   	push   %eax
  801567:	ff d2                	call   *%edx
  801569:	83 c4 10             	add    $0x10,%esp
}
  80156c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80156f:	c9                   	leave  
  801570:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  801571:	a1 04 40 80 00       	mov    0x804004,%eax
  801576:	8b 40 48             	mov    0x48(%eax),%eax
  801579:	83 ec 04             	sub    $0x4,%esp
  80157c:	53                   	push   %ebx
  80157d:	50                   	push   %eax
  80157e:	68 99 28 80 00       	push   $0x802899
  801583:	e8 40 ec ff ff       	call   8001c8 <cprintf>
		return -E_INVAL;
  801588:	83 c4 10             	add    $0x10,%esp
  80158b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801590:	eb da                	jmp    80156c <write+0x59>
		return -E_NOT_SUPP;
  801592:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801597:	eb d3                	jmp    80156c <write+0x59>

00801599 <seek>:

int
seek(int fdnum, off_t offset)
{
  801599:	f3 0f 1e fb          	endbr32 
  80159d:	55                   	push   %ebp
  80159e:	89 e5                	mov    %esp,%ebp
  8015a0:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  8015a3:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015a6:	50                   	push   %eax
  8015a7:	ff 75 08             	pushl  0x8(%ebp)
  8015aa:	e8 0b fc ff ff       	call   8011ba <fd_lookup>
  8015af:	83 c4 10             	add    $0x10,%esp
  8015b2:	85 c0                	test   %eax,%eax
  8015b4:	78 0e                	js     8015c4 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  8015b6:	8b 55 0c             	mov    0xc(%ebp),%edx
  8015b9:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015bc:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  8015bf:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8015c4:	c9                   	leave  
  8015c5:	c3                   	ret    

008015c6 <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  8015c6:	f3 0f 1e fb          	endbr32 
  8015ca:	55                   	push   %ebp
  8015cb:	89 e5                	mov    %esp,%ebp
  8015cd:	53                   	push   %ebx
  8015ce:	83 ec 1c             	sub    $0x1c,%esp
  8015d1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  8015d4:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8015d7:	50                   	push   %eax
  8015d8:	53                   	push   %ebx
  8015d9:	e8 dc fb ff ff       	call   8011ba <fd_lookup>
  8015de:	83 c4 10             	add    $0x10,%esp
  8015e1:	85 c0                	test   %eax,%eax
  8015e3:	78 37                	js     80161c <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015e5:	83 ec 08             	sub    $0x8,%esp
  8015e8:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015eb:	50                   	push   %eax
  8015ec:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015ef:	ff 30                	pushl  (%eax)
  8015f1:	e8 18 fc ff ff       	call   80120e <dev_lookup>
  8015f6:	83 c4 10             	add    $0x10,%esp
  8015f9:	85 c0                	test   %eax,%eax
  8015fb:	78 1f                	js     80161c <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8015fd:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801600:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801604:	74 1b                	je     801621 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  801606:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801609:	8b 52 18             	mov    0x18(%edx),%edx
  80160c:	85 d2                	test   %edx,%edx
  80160e:	74 32                	je     801642 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801610:	83 ec 08             	sub    $0x8,%esp
  801613:	ff 75 0c             	pushl  0xc(%ebp)
  801616:	50                   	push   %eax
  801617:	ff d2                	call   *%edx
  801619:	83 c4 10             	add    $0x10,%esp
}
  80161c:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80161f:	c9                   	leave  
  801620:	c3                   	ret    
			thisenv->env_id, fdnum);
  801621:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  801626:	8b 40 48             	mov    0x48(%eax),%eax
  801629:	83 ec 04             	sub    $0x4,%esp
  80162c:	53                   	push   %ebx
  80162d:	50                   	push   %eax
  80162e:	68 5c 28 80 00       	push   $0x80285c
  801633:	e8 90 eb ff ff       	call   8001c8 <cprintf>
		return -E_INVAL;
  801638:	83 c4 10             	add    $0x10,%esp
  80163b:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801640:	eb da                	jmp    80161c <ftruncate+0x56>
		return -E_NOT_SUPP;
  801642:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801647:	eb d3                	jmp    80161c <ftruncate+0x56>

00801649 <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  801649:	f3 0f 1e fb          	endbr32 
  80164d:	55                   	push   %ebp
  80164e:	89 e5                	mov    %esp,%ebp
  801650:	53                   	push   %ebx
  801651:	83 ec 1c             	sub    $0x1c,%esp
  801654:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801657:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80165a:	50                   	push   %eax
  80165b:	ff 75 08             	pushl  0x8(%ebp)
  80165e:	e8 57 fb ff ff       	call   8011ba <fd_lookup>
  801663:	83 c4 10             	add    $0x10,%esp
  801666:	85 c0                	test   %eax,%eax
  801668:	78 4b                	js     8016b5 <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80166a:	83 ec 08             	sub    $0x8,%esp
  80166d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801670:	50                   	push   %eax
  801671:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801674:	ff 30                	pushl  (%eax)
  801676:	e8 93 fb ff ff       	call   80120e <dev_lookup>
  80167b:	83 c4 10             	add    $0x10,%esp
  80167e:	85 c0                	test   %eax,%eax
  801680:	78 33                	js     8016b5 <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  801682:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801685:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  801689:	74 2f                	je     8016ba <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  80168b:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  80168e:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  801695:	00 00 00 
	stat->st_isdir = 0;
  801698:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  80169f:	00 00 00 
	stat->st_dev = dev;
  8016a2:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  8016a8:	83 ec 08             	sub    $0x8,%esp
  8016ab:	53                   	push   %ebx
  8016ac:	ff 75 f0             	pushl  -0x10(%ebp)
  8016af:	ff 50 14             	call   *0x14(%eax)
  8016b2:	83 c4 10             	add    $0x10,%esp
}
  8016b5:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016b8:	c9                   	leave  
  8016b9:	c3                   	ret    
		return -E_NOT_SUPP;
  8016ba:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016bf:	eb f4                	jmp    8016b5 <fstat+0x6c>

008016c1 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  8016c1:	f3 0f 1e fb          	endbr32 
  8016c5:	55                   	push   %ebp
  8016c6:	89 e5                	mov    %esp,%ebp
  8016c8:	56                   	push   %esi
  8016c9:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  8016ca:	83 ec 08             	sub    $0x8,%esp
  8016cd:	6a 00                	push   $0x0
  8016cf:	ff 75 08             	pushl  0x8(%ebp)
  8016d2:	e8 fb 01 00 00       	call   8018d2 <open>
  8016d7:	89 c3                	mov    %eax,%ebx
  8016d9:	83 c4 10             	add    $0x10,%esp
  8016dc:	85 c0                	test   %eax,%eax
  8016de:	78 1b                	js     8016fb <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  8016e0:	83 ec 08             	sub    $0x8,%esp
  8016e3:	ff 75 0c             	pushl  0xc(%ebp)
  8016e6:	50                   	push   %eax
  8016e7:	e8 5d ff ff ff       	call   801649 <fstat>
  8016ec:	89 c6                	mov    %eax,%esi
	close(fd);
  8016ee:	89 1c 24             	mov    %ebx,(%esp)
  8016f1:	e8 fd fb ff ff       	call   8012f3 <close>
	return r;
  8016f6:	83 c4 10             	add    $0x10,%esp
  8016f9:	89 f3                	mov    %esi,%ebx
}
  8016fb:	89 d8                	mov    %ebx,%eax
  8016fd:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801700:	5b                   	pop    %ebx
  801701:	5e                   	pop    %esi
  801702:	5d                   	pop    %ebp
  801703:	c3                   	ret    

00801704 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801704:	55                   	push   %ebp
  801705:	89 e5                	mov    %esp,%ebp
  801707:	56                   	push   %esi
  801708:	53                   	push   %ebx
  801709:	89 c6                	mov    %eax,%esi
  80170b:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  80170d:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801714:	74 27                	je     80173d <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  801716:	6a 07                	push   $0x7
  801718:	68 00 50 80 00       	push   $0x805000
  80171d:	56                   	push   %esi
  80171e:	ff 35 00 40 80 00    	pushl  0x804000
  801724:	e8 bd 08 00 00       	call   801fe6 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  801729:	83 c4 0c             	add    $0xc,%esp
  80172c:	6a 00                	push   $0x0
  80172e:	53                   	push   %ebx
  80172f:	6a 00                	push   $0x0
  801731:	e8 2f 08 00 00       	call   801f65 <ipc_recv>
}
  801736:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801739:	5b                   	pop    %ebx
  80173a:	5e                   	pop    %esi
  80173b:	5d                   	pop    %ebp
  80173c:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  80173d:	83 ec 0c             	sub    $0xc,%esp
  801740:	6a 01                	push   $0x1
  801742:	e8 f7 08 00 00       	call   80203e <ipc_find_env>
  801747:	a3 00 40 80 00       	mov    %eax,0x804000
  80174c:	83 c4 10             	add    $0x10,%esp
  80174f:	eb c5                	jmp    801716 <fsipc+0x12>

00801751 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  801751:	f3 0f 1e fb          	endbr32 
  801755:	55                   	push   %ebp
  801756:	89 e5                	mov    %esp,%ebp
  801758:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  80175b:	8b 45 08             	mov    0x8(%ebp),%eax
  80175e:	8b 40 0c             	mov    0xc(%eax),%eax
  801761:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  801766:	8b 45 0c             	mov    0xc(%ebp),%eax
  801769:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  80176e:	ba 00 00 00 00       	mov    $0x0,%edx
  801773:	b8 02 00 00 00       	mov    $0x2,%eax
  801778:	e8 87 ff ff ff       	call   801704 <fsipc>
}
  80177d:	c9                   	leave  
  80177e:	c3                   	ret    

0080177f <devfile_flush>:
{
  80177f:	f3 0f 1e fb          	endbr32 
  801783:	55                   	push   %ebp
  801784:	89 e5                	mov    %esp,%ebp
  801786:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  801789:	8b 45 08             	mov    0x8(%ebp),%eax
  80178c:	8b 40 0c             	mov    0xc(%eax),%eax
  80178f:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  801794:	ba 00 00 00 00       	mov    $0x0,%edx
  801799:	b8 06 00 00 00       	mov    $0x6,%eax
  80179e:	e8 61 ff ff ff       	call   801704 <fsipc>
}
  8017a3:	c9                   	leave  
  8017a4:	c3                   	ret    

008017a5 <devfile_stat>:
{
  8017a5:	f3 0f 1e fb          	endbr32 
  8017a9:	55                   	push   %ebp
  8017aa:	89 e5                	mov    %esp,%ebp
  8017ac:	53                   	push   %ebx
  8017ad:	83 ec 04             	sub    $0x4,%esp
  8017b0:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  8017b3:	8b 45 08             	mov    0x8(%ebp),%eax
  8017b6:	8b 40 0c             	mov    0xc(%eax),%eax
  8017b9:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  8017be:	ba 00 00 00 00       	mov    $0x0,%edx
  8017c3:	b8 05 00 00 00       	mov    $0x5,%eax
  8017c8:	e8 37 ff ff ff       	call   801704 <fsipc>
  8017cd:	85 c0                	test   %eax,%eax
  8017cf:	78 2c                	js     8017fd <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  8017d1:	83 ec 08             	sub    $0x8,%esp
  8017d4:	68 00 50 80 00       	push   $0x805000
  8017d9:	53                   	push   %ebx
  8017da:	e8 c2 ef ff ff       	call   8007a1 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  8017df:	a1 80 50 80 00       	mov    0x805080,%eax
  8017e4:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  8017ea:	a1 84 50 80 00       	mov    0x805084,%eax
  8017ef:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  8017f5:	83 c4 10             	add    $0x10,%esp
  8017f8:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8017fd:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801800:	c9                   	leave  
  801801:	c3                   	ret    

00801802 <devfile_write>:
{
  801802:	f3 0f 1e fb          	endbr32 
  801806:	55                   	push   %ebp
  801807:	89 e5                	mov    %esp,%ebp
  801809:	83 ec 0c             	sub    $0xc,%esp
  80180c:	8b 45 10             	mov    0x10(%ebp),%eax
  80180f:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801814:	ba f8 0f 00 00       	mov    $0xff8,%edx
  801819:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  80181c:	8b 55 08             	mov    0x8(%ebp),%edx
  80181f:	8b 52 0c             	mov    0xc(%edx),%edx
  801822:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  801828:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  80182d:	50                   	push   %eax
  80182e:	ff 75 0c             	pushl  0xc(%ebp)
  801831:	68 08 50 80 00       	push   $0x805008
  801836:	e8 1c f1 ff ff       	call   800957 <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  80183b:	ba 00 00 00 00       	mov    $0x0,%edx
  801840:	b8 04 00 00 00       	mov    $0x4,%eax
  801845:	e8 ba fe ff ff       	call   801704 <fsipc>
  80184a:	c9                   	leave  
  80184b:	c3                   	ret    

0080184c <devfile_read>:
{
  80184c:	f3 0f 1e fb          	endbr32 
  801850:	55                   	push   %ebp
  801851:	89 e5                	mov    %esp,%ebp
  801853:	56                   	push   %esi
  801854:	53                   	push   %ebx
  801855:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  801858:	8b 45 08             	mov    0x8(%ebp),%eax
  80185b:	8b 40 0c             	mov    0xc(%eax),%eax
  80185e:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  801863:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  801869:	ba 00 00 00 00       	mov    $0x0,%edx
  80186e:	b8 03 00 00 00       	mov    $0x3,%eax
  801873:	e8 8c fe ff ff       	call   801704 <fsipc>
  801878:	89 c3                	mov    %eax,%ebx
  80187a:	85 c0                	test   %eax,%eax
  80187c:	78 1f                	js     80189d <devfile_read+0x51>
	assert(r <= n);
  80187e:	39 f0                	cmp    %esi,%eax
  801880:	77 24                	ja     8018a6 <devfile_read+0x5a>
	assert(r <= PGSIZE);
  801882:	3d 00 10 00 00       	cmp    $0x1000,%eax
  801887:	7f 33                	jg     8018bc <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  801889:	83 ec 04             	sub    $0x4,%esp
  80188c:	50                   	push   %eax
  80188d:	68 00 50 80 00       	push   $0x805000
  801892:	ff 75 0c             	pushl  0xc(%ebp)
  801895:	e8 bd f0 ff ff       	call   800957 <memmove>
	return r;
  80189a:	83 c4 10             	add    $0x10,%esp
}
  80189d:	89 d8                	mov    %ebx,%eax
  80189f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8018a2:	5b                   	pop    %ebx
  8018a3:	5e                   	pop    %esi
  8018a4:	5d                   	pop    %ebp
  8018a5:	c3                   	ret    
	assert(r <= n);
  8018a6:	68 c8 28 80 00       	push   $0x8028c8
  8018ab:	68 cf 28 80 00       	push   $0x8028cf
  8018b0:	6a 7c                	push   $0x7c
  8018b2:	68 e4 28 80 00       	push   $0x8028e4
  8018b7:	e8 be 05 00 00       	call   801e7a <_panic>
	assert(r <= PGSIZE);
  8018bc:	68 ef 28 80 00       	push   $0x8028ef
  8018c1:	68 cf 28 80 00       	push   $0x8028cf
  8018c6:	6a 7d                	push   $0x7d
  8018c8:	68 e4 28 80 00       	push   $0x8028e4
  8018cd:	e8 a8 05 00 00       	call   801e7a <_panic>

008018d2 <open>:
{
  8018d2:	f3 0f 1e fb          	endbr32 
  8018d6:	55                   	push   %ebp
  8018d7:	89 e5                	mov    %esp,%ebp
  8018d9:	56                   	push   %esi
  8018da:	53                   	push   %ebx
  8018db:	83 ec 1c             	sub    $0x1c,%esp
  8018de:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  8018e1:	56                   	push   %esi
  8018e2:	e8 77 ee ff ff       	call   80075e <strlen>
  8018e7:	83 c4 10             	add    $0x10,%esp
  8018ea:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  8018ef:	7f 6c                	jg     80195d <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  8018f1:	83 ec 0c             	sub    $0xc,%esp
  8018f4:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8018f7:	50                   	push   %eax
  8018f8:	e8 67 f8 ff ff       	call   801164 <fd_alloc>
  8018fd:	89 c3                	mov    %eax,%ebx
  8018ff:	83 c4 10             	add    $0x10,%esp
  801902:	85 c0                	test   %eax,%eax
  801904:	78 3c                	js     801942 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801906:	83 ec 08             	sub    $0x8,%esp
  801909:	56                   	push   %esi
  80190a:	68 00 50 80 00       	push   $0x805000
  80190f:	e8 8d ee ff ff       	call   8007a1 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801914:	8b 45 0c             	mov    0xc(%ebp),%eax
  801917:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  80191c:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80191f:	b8 01 00 00 00       	mov    $0x1,%eax
  801924:	e8 db fd ff ff       	call   801704 <fsipc>
  801929:	89 c3                	mov    %eax,%ebx
  80192b:	83 c4 10             	add    $0x10,%esp
  80192e:	85 c0                	test   %eax,%eax
  801930:	78 19                	js     80194b <open+0x79>
	return fd2num(fd);
  801932:	83 ec 0c             	sub    $0xc,%esp
  801935:	ff 75 f4             	pushl  -0xc(%ebp)
  801938:	e8 f8 f7 ff ff       	call   801135 <fd2num>
  80193d:	89 c3                	mov    %eax,%ebx
  80193f:	83 c4 10             	add    $0x10,%esp
}
  801942:	89 d8                	mov    %ebx,%eax
  801944:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801947:	5b                   	pop    %ebx
  801948:	5e                   	pop    %esi
  801949:	5d                   	pop    %ebp
  80194a:	c3                   	ret    
		fd_close(fd, 0);
  80194b:	83 ec 08             	sub    $0x8,%esp
  80194e:	6a 00                	push   $0x0
  801950:	ff 75 f4             	pushl  -0xc(%ebp)
  801953:	e8 10 f9 ff ff       	call   801268 <fd_close>
		return r;
  801958:	83 c4 10             	add    $0x10,%esp
  80195b:	eb e5                	jmp    801942 <open+0x70>
		return -E_BAD_PATH;
  80195d:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801962:	eb de                	jmp    801942 <open+0x70>

00801964 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801964:	f3 0f 1e fb          	endbr32 
  801968:	55                   	push   %ebp
  801969:	89 e5                	mov    %esp,%ebp
  80196b:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  80196e:	ba 00 00 00 00       	mov    $0x0,%edx
  801973:	b8 08 00 00 00       	mov    $0x8,%eax
  801978:	e8 87 fd ff ff       	call   801704 <fsipc>
}
  80197d:	c9                   	leave  
  80197e:	c3                   	ret    

0080197f <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  80197f:	f3 0f 1e fb          	endbr32 
  801983:	55                   	push   %ebp
  801984:	89 e5                	mov    %esp,%ebp
  801986:	56                   	push   %esi
  801987:	53                   	push   %ebx
  801988:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  80198b:	83 ec 0c             	sub    $0xc,%esp
  80198e:	ff 75 08             	pushl  0x8(%ebp)
  801991:	e8 b3 f7 ff ff       	call   801149 <fd2data>
  801996:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801998:	83 c4 08             	add    $0x8,%esp
  80199b:	68 fb 28 80 00       	push   $0x8028fb
  8019a0:	53                   	push   %ebx
  8019a1:	e8 fb ed ff ff       	call   8007a1 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  8019a6:	8b 46 04             	mov    0x4(%esi),%eax
  8019a9:	2b 06                	sub    (%esi),%eax
  8019ab:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  8019b1:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  8019b8:	00 00 00 
	stat->st_dev = &devpipe;
  8019bb:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  8019c2:	30 80 00 
	return 0;
}
  8019c5:	b8 00 00 00 00       	mov    $0x0,%eax
  8019ca:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8019cd:	5b                   	pop    %ebx
  8019ce:	5e                   	pop    %esi
  8019cf:	5d                   	pop    %ebp
  8019d0:	c3                   	ret    

008019d1 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  8019d1:	f3 0f 1e fb          	endbr32 
  8019d5:	55                   	push   %ebp
  8019d6:	89 e5                	mov    %esp,%ebp
  8019d8:	53                   	push   %ebx
  8019d9:	83 ec 0c             	sub    $0xc,%esp
  8019dc:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  8019df:	53                   	push   %ebx
  8019e0:	6a 00                	push   $0x0
  8019e2:	e8 89 f2 ff ff       	call   800c70 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  8019e7:	89 1c 24             	mov    %ebx,(%esp)
  8019ea:	e8 5a f7 ff ff       	call   801149 <fd2data>
  8019ef:	83 c4 08             	add    $0x8,%esp
  8019f2:	50                   	push   %eax
  8019f3:	6a 00                	push   $0x0
  8019f5:	e8 76 f2 ff ff       	call   800c70 <sys_page_unmap>
}
  8019fa:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8019fd:	c9                   	leave  
  8019fe:	c3                   	ret    

008019ff <_pipeisclosed>:
{
  8019ff:	55                   	push   %ebp
  801a00:	89 e5                	mov    %esp,%ebp
  801a02:	57                   	push   %edi
  801a03:	56                   	push   %esi
  801a04:	53                   	push   %ebx
  801a05:	83 ec 1c             	sub    $0x1c,%esp
  801a08:	89 c7                	mov    %eax,%edi
  801a0a:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801a0c:	a1 04 40 80 00       	mov    0x804004,%eax
  801a11:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801a14:	83 ec 0c             	sub    $0xc,%esp
  801a17:	57                   	push   %edi
  801a18:	e8 5e 06 00 00       	call   80207b <pageref>
  801a1d:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801a20:	89 34 24             	mov    %esi,(%esp)
  801a23:	e8 53 06 00 00       	call   80207b <pageref>
		nn = thisenv->env_runs;
  801a28:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801a2e:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801a31:	83 c4 10             	add    $0x10,%esp
  801a34:	39 cb                	cmp    %ecx,%ebx
  801a36:	74 1b                	je     801a53 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801a38:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801a3b:	75 cf                	jne    801a0c <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801a3d:	8b 42 58             	mov    0x58(%edx),%eax
  801a40:	6a 01                	push   $0x1
  801a42:	50                   	push   %eax
  801a43:	53                   	push   %ebx
  801a44:	68 02 29 80 00       	push   $0x802902
  801a49:	e8 7a e7 ff ff       	call   8001c8 <cprintf>
  801a4e:	83 c4 10             	add    $0x10,%esp
  801a51:	eb b9                	jmp    801a0c <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801a53:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801a56:	0f 94 c0             	sete   %al
  801a59:	0f b6 c0             	movzbl %al,%eax
}
  801a5c:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801a5f:	5b                   	pop    %ebx
  801a60:	5e                   	pop    %esi
  801a61:	5f                   	pop    %edi
  801a62:	5d                   	pop    %ebp
  801a63:	c3                   	ret    

00801a64 <devpipe_write>:
{
  801a64:	f3 0f 1e fb          	endbr32 
  801a68:	55                   	push   %ebp
  801a69:	89 e5                	mov    %esp,%ebp
  801a6b:	57                   	push   %edi
  801a6c:	56                   	push   %esi
  801a6d:	53                   	push   %ebx
  801a6e:	83 ec 28             	sub    $0x28,%esp
  801a71:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801a74:	56                   	push   %esi
  801a75:	e8 cf f6 ff ff       	call   801149 <fd2data>
  801a7a:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801a7c:	83 c4 10             	add    $0x10,%esp
  801a7f:	bf 00 00 00 00       	mov    $0x0,%edi
  801a84:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801a87:	74 4f                	je     801ad8 <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801a89:	8b 43 04             	mov    0x4(%ebx),%eax
  801a8c:	8b 0b                	mov    (%ebx),%ecx
  801a8e:	8d 51 20             	lea    0x20(%ecx),%edx
  801a91:	39 d0                	cmp    %edx,%eax
  801a93:	72 14                	jb     801aa9 <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801a95:	89 da                	mov    %ebx,%edx
  801a97:	89 f0                	mov    %esi,%eax
  801a99:	e8 61 ff ff ff       	call   8019ff <_pipeisclosed>
  801a9e:	85 c0                	test   %eax,%eax
  801aa0:	75 3b                	jne    801add <devpipe_write+0x79>
			sys_yield();
  801aa2:	e8 19 f1 ff ff       	call   800bc0 <sys_yield>
  801aa7:	eb e0                	jmp    801a89 <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801aa9:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801aac:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801ab0:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801ab3:	89 c2                	mov    %eax,%edx
  801ab5:	c1 fa 1f             	sar    $0x1f,%edx
  801ab8:	89 d1                	mov    %edx,%ecx
  801aba:	c1 e9 1b             	shr    $0x1b,%ecx
  801abd:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801ac0:	83 e2 1f             	and    $0x1f,%edx
  801ac3:	29 ca                	sub    %ecx,%edx
  801ac5:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801ac9:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801acd:	83 c0 01             	add    $0x1,%eax
  801ad0:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801ad3:	83 c7 01             	add    $0x1,%edi
  801ad6:	eb ac                	jmp    801a84 <devpipe_write+0x20>
	return i;
  801ad8:	8b 45 10             	mov    0x10(%ebp),%eax
  801adb:	eb 05                	jmp    801ae2 <devpipe_write+0x7e>
				return 0;
  801add:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801ae2:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ae5:	5b                   	pop    %ebx
  801ae6:	5e                   	pop    %esi
  801ae7:	5f                   	pop    %edi
  801ae8:	5d                   	pop    %ebp
  801ae9:	c3                   	ret    

00801aea <devpipe_read>:
{
  801aea:	f3 0f 1e fb          	endbr32 
  801aee:	55                   	push   %ebp
  801aef:	89 e5                	mov    %esp,%ebp
  801af1:	57                   	push   %edi
  801af2:	56                   	push   %esi
  801af3:	53                   	push   %ebx
  801af4:	83 ec 18             	sub    $0x18,%esp
  801af7:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801afa:	57                   	push   %edi
  801afb:	e8 49 f6 ff ff       	call   801149 <fd2data>
  801b00:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801b02:	83 c4 10             	add    $0x10,%esp
  801b05:	be 00 00 00 00       	mov    $0x0,%esi
  801b0a:	3b 75 10             	cmp    0x10(%ebp),%esi
  801b0d:	75 14                	jne    801b23 <devpipe_read+0x39>
	return i;
  801b0f:	8b 45 10             	mov    0x10(%ebp),%eax
  801b12:	eb 02                	jmp    801b16 <devpipe_read+0x2c>
				return i;
  801b14:	89 f0                	mov    %esi,%eax
}
  801b16:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801b19:	5b                   	pop    %ebx
  801b1a:	5e                   	pop    %esi
  801b1b:	5f                   	pop    %edi
  801b1c:	5d                   	pop    %ebp
  801b1d:	c3                   	ret    
			sys_yield();
  801b1e:	e8 9d f0 ff ff       	call   800bc0 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801b23:	8b 03                	mov    (%ebx),%eax
  801b25:	3b 43 04             	cmp    0x4(%ebx),%eax
  801b28:	75 18                	jne    801b42 <devpipe_read+0x58>
			if (i > 0)
  801b2a:	85 f6                	test   %esi,%esi
  801b2c:	75 e6                	jne    801b14 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801b2e:	89 da                	mov    %ebx,%edx
  801b30:	89 f8                	mov    %edi,%eax
  801b32:	e8 c8 fe ff ff       	call   8019ff <_pipeisclosed>
  801b37:	85 c0                	test   %eax,%eax
  801b39:	74 e3                	je     801b1e <devpipe_read+0x34>
				return 0;
  801b3b:	b8 00 00 00 00       	mov    $0x0,%eax
  801b40:	eb d4                	jmp    801b16 <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801b42:	99                   	cltd   
  801b43:	c1 ea 1b             	shr    $0x1b,%edx
  801b46:	01 d0                	add    %edx,%eax
  801b48:	83 e0 1f             	and    $0x1f,%eax
  801b4b:	29 d0                	sub    %edx,%eax
  801b4d:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801b52:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801b55:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801b58:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801b5b:	83 c6 01             	add    $0x1,%esi
  801b5e:	eb aa                	jmp    801b0a <devpipe_read+0x20>

00801b60 <pipe>:
{
  801b60:	f3 0f 1e fb          	endbr32 
  801b64:	55                   	push   %ebp
  801b65:	89 e5                	mov    %esp,%ebp
  801b67:	56                   	push   %esi
  801b68:	53                   	push   %ebx
  801b69:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801b6c:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801b6f:	50                   	push   %eax
  801b70:	e8 ef f5 ff ff       	call   801164 <fd_alloc>
  801b75:	89 c3                	mov    %eax,%ebx
  801b77:	83 c4 10             	add    $0x10,%esp
  801b7a:	85 c0                	test   %eax,%eax
  801b7c:	0f 88 23 01 00 00    	js     801ca5 <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801b82:	83 ec 04             	sub    $0x4,%esp
  801b85:	68 07 04 00 00       	push   $0x407
  801b8a:	ff 75 f4             	pushl  -0xc(%ebp)
  801b8d:	6a 00                	push   $0x0
  801b8f:	e8 4f f0 ff ff       	call   800be3 <sys_page_alloc>
  801b94:	89 c3                	mov    %eax,%ebx
  801b96:	83 c4 10             	add    $0x10,%esp
  801b99:	85 c0                	test   %eax,%eax
  801b9b:	0f 88 04 01 00 00    	js     801ca5 <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801ba1:	83 ec 0c             	sub    $0xc,%esp
  801ba4:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801ba7:	50                   	push   %eax
  801ba8:	e8 b7 f5 ff ff       	call   801164 <fd_alloc>
  801bad:	89 c3                	mov    %eax,%ebx
  801baf:	83 c4 10             	add    $0x10,%esp
  801bb2:	85 c0                	test   %eax,%eax
  801bb4:	0f 88 db 00 00 00    	js     801c95 <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801bba:	83 ec 04             	sub    $0x4,%esp
  801bbd:	68 07 04 00 00       	push   $0x407
  801bc2:	ff 75 f0             	pushl  -0x10(%ebp)
  801bc5:	6a 00                	push   $0x0
  801bc7:	e8 17 f0 ff ff       	call   800be3 <sys_page_alloc>
  801bcc:	89 c3                	mov    %eax,%ebx
  801bce:	83 c4 10             	add    $0x10,%esp
  801bd1:	85 c0                	test   %eax,%eax
  801bd3:	0f 88 bc 00 00 00    	js     801c95 <pipe+0x135>
	va = fd2data(fd0);
  801bd9:	83 ec 0c             	sub    $0xc,%esp
  801bdc:	ff 75 f4             	pushl  -0xc(%ebp)
  801bdf:	e8 65 f5 ff ff       	call   801149 <fd2data>
  801be4:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801be6:	83 c4 0c             	add    $0xc,%esp
  801be9:	68 07 04 00 00       	push   $0x407
  801bee:	50                   	push   %eax
  801bef:	6a 00                	push   $0x0
  801bf1:	e8 ed ef ff ff       	call   800be3 <sys_page_alloc>
  801bf6:	89 c3                	mov    %eax,%ebx
  801bf8:	83 c4 10             	add    $0x10,%esp
  801bfb:	85 c0                	test   %eax,%eax
  801bfd:	0f 88 82 00 00 00    	js     801c85 <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801c03:	83 ec 0c             	sub    $0xc,%esp
  801c06:	ff 75 f0             	pushl  -0x10(%ebp)
  801c09:	e8 3b f5 ff ff       	call   801149 <fd2data>
  801c0e:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801c15:	50                   	push   %eax
  801c16:	6a 00                	push   $0x0
  801c18:	56                   	push   %esi
  801c19:	6a 00                	push   $0x0
  801c1b:	e8 0a f0 ff ff       	call   800c2a <sys_page_map>
  801c20:	89 c3                	mov    %eax,%ebx
  801c22:	83 c4 20             	add    $0x20,%esp
  801c25:	85 c0                	test   %eax,%eax
  801c27:	78 4e                	js     801c77 <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801c29:	a1 20 30 80 00       	mov    0x803020,%eax
  801c2e:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801c31:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801c33:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801c36:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801c3d:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801c40:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801c42:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801c45:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801c4c:	83 ec 0c             	sub    $0xc,%esp
  801c4f:	ff 75 f4             	pushl  -0xc(%ebp)
  801c52:	e8 de f4 ff ff       	call   801135 <fd2num>
  801c57:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801c5a:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801c5c:	83 c4 04             	add    $0x4,%esp
  801c5f:	ff 75 f0             	pushl  -0x10(%ebp)
  801c62:	e8 ce f4 ff ff       	call   801135 <fd2num>
  801c67:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801c6a:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801c6d:	83 c4 10             	add    $0x10,%esp
  801c70:	bb 00 00 00 00       	mov    $0x0,%ebx
  801c75:	eb 2e                	jmp    801ca5 <pipe+0x145>
	sys_page_unmap(0, va);
  801c77:	83 ec 08             	sub    $0x8,%esp
  801c7a:	56                   	push   %esi
  801c7b:	6a 00                	push   $0x0
  801c7d:	e8 ee ef ff ff       	call   800c70 <sys_page_unmap>
  801c82:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801c85:	83 ec 08             	sub    $0x8,%esp
  801c88:	ff 75 f0             	pushl  -0x10(%ebp)
  801c8b:	6a 00                	push   $0x0
  801c8d:	e8 de ef ff ff       	call   800c70 <sys_page_unmap>
  801c92:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801c95:	83 ec 08             	sub    $0x8,%esp
  801c98:	ff 75 f4             	pushl  -0xc(%ebp)
  801c9b:	6a 00                	push   $0x0
  801c9d:	e8 ce ef ff ff       	call   800c70 <sys_page_unmap>
  801ca2:	83 c4 10             	add    $0x10,%esp
}
  801ca5:	89 d8                	mov    %ebx,%eax
  801ca7:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801caa:	5b                   	pop    %ebx
  801cab:	5e                   	pop    %esi
  801cac:	5d                   	pop    %ebp
  801cad:	c3                   	ret    

00801cae <pipeisclosed>:
{
  801cae:	f3 0f 1e fb          	endbr32 
  801cb2:	55                   	push   %ebp
  801cb3:	89 e5                	mov    %esp,%ebp
  801cb5:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801cb8:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cbb:	50                   	push   %eax
  801cbc:	ff 75 08             	pushl  0x8(%ebp)
  801cbf:	e8 f6 f4 ff ff       	call   8011ba <fd_lookup>
  801cc4:	83 c4 10             	add    $0x10,%esp
  801cc7:	85 c0                	test   %eax,%eax
  801cc9:	78 18                	js     801ce3 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801ccb:	83 ec 0c             	sub    $0xc,%esp
  801cce:	ff 75 f4             	pushl  -0xc(%ebp)
  801cd1:	e8 73 f4 ff ff       	call   801149 <fd2data>
  801cd6:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801cd8:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801cdb:	e8 1f fd ff ff       	call   8019ff <_pipeisclosed>
  801ce0:	83 c4 10             	add    $0x10,%esp
}
  801ce3:	c9                   	leave  
  801ce4:	c3                   	ret    

00801ce5 <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801ce5:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801ce9:	b8 00 00 00 00       	mov    $0x0,%eax
  801cee:	c3                   	ret    

00801cef <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801cef:	f3 0f 1e fb          	endbr32 
  801cf3:	55                   	push   %ebp
  801cf4:	89 e5                	mov    %esp,%ebp
  801cf6:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801cf9:	68 1a 29 80 00       	push   $0x80291a
  801cfe:	ff 75 0c             	pushl  0xc(%ebp)
  801d01:	e8 9b ea ff ff       	call   8007a1 <strcpy>
	return 0;
}
  801d06:	b8 00 00 00 00       	mov    $0x0,%eax
  801d0b:	c9                   	leave  
  801d0c:	c3                   	ret    

00801d0d <devcons_write>:
{
  801d0d:	f3 0f 1e fb          	endbr32 
  801d11:	55                   	push   %ebp
  801d12:	89 e5                	mov    %esp,%ebp
  801d14:	57                   	push   %edi
  801d15:	56                   	push   %esi
  801d16:	53                   	push   %ebx
  801d17:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801d1d:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801d22:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801d28:	3b 75 10             	cmp    0x10(%ebp),%esi
  801d2b:	73 31                	jae    801d5e <devcons_write+0x51>
		m = n - tot;
  801d2d:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801d30:	29 f3                	sub    %esi,%ebx
  801d32:	83 fb 7f             	cmp    $0x7f,%ebx
  801d35:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801d3a:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801d3d:	83 ec 04             	sub    $0x4,%esp
  801d40:	53                   	push   %ebx
  801d41:	89 f0                	mov    %esi,%eax
  801d43:	03 45 0c             	add    0xc(%ebp),%eax
  801d46:	50                   	push   %eax
  801d47:	57                   	push   %edi
  801d48:	e8 0a ec ff ff       	call   800957 <memmove>
		sys_cputs(buf, m);
  801d4d:	83 c4 08             	add    $0x8,%esp
  801d50:	53                   	push   %ebx
  801d51:	57                   	push   %edi
  801d52:	e8 bc ed ff ff       	call   800b13 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801d57:	01 de                	add    %ebx,%esi
  801d59:	83 c4 10             	add    $0x10,%esp
  801d5c:	eb ca                	jmp    801d28 <devcons_write+0x1b>
}
  801d5e:	89 f0                	mov    %esi,%eax
  801d60:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801d63:	5b                   	pop    %ebx
  801d64:	5e                   	pop    %esi
  801d65:	5f                   	pop    %edi
  801d66:	5d                   	pop    %ebp
  801d67:	c3                   	ret    

00801d68 <devcons_read>:
{
  801d68:	f3 0f 1e fb          	endbr32 
  801d6c:	55                   	push   %ebp
  801d6d:	89 e5                	mov    %esp,%ebp
  801d6f:	83 ec 08             	sub    $0x8,%esp
  801d72:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801d77:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801d7b:	74 21                	je     801d9e <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801d7d:	e8 b3 ed ff ff       	call   800b35 <sys_cgetc>
  801d82:	85 c0                	test   %eax,%eax
  801d84:	75 07                	jne    801d8d <devcons_read+0x25>
		sys_yield();
  801d86:	e8 35 ee ff ff       	call   800bc0 <sys_yield>
  801d8b:	eb f0                	jmp    801d7d <devcons_read+0x15>
	if (c < 0)
  801d8d:	78 0f                	js     801d9e <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801d8f:	83 f8 04             	cmp    $0x4,%eax
  801d92:	74 0c                	je     801da0 <devcons_read+0x38>
	*(char*)vbuf = c;
  801d94:	8b 55 0c             	mov    0xc(%ebp),%edx
  801d97:	88 02                	mov    %al,(%edx)
	return 1;
  801d99:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801d9e:	c9                   	leave  
  801d9f:	c3                   	ret    
		return 0;
  801da0:	b8 00 00 00 00       	mov    $0x0,%eax
  801da5:	eb f7                	jmp    801d9e <devcons_read+0x36>

00801da7 <cputchar>:
{
  801da7:	f3 0f 1e fb          	endbr32 
  801dab:	55                   	push   %ebp
  801dac:	89 e5                	mov    %esp,%ebp
  801dae:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801db1:	8b 45 08             	mov    0x8(%ebp),%eax
  801db4:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801db7:	6a 01                	push   $0x1
  801db9:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801dbc:	50                   	push   %eax
  801dbd:	e8 51 ed ff ff       	call   800b13 <sys_cputs>
}
  801dc2:	83 c4 10             	add    $0x10,%esp
  801dc5:	c9                   	leave  
  801dc6:	c3                   	ret    

00801dc7 <getchar>:
{
  801dc7:	f3 0f 1e fb          	endbr32 
  801dcb:	55                   	push   %ebp
  801dcc:	89 e5                	mov    %esp,%ebp
  801dce:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801dd1:	6a 01                	push   $0x1
  801dd3:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801dd6:	50                   	push   %eax
  801dd7:	6a 00                	push   $0x0
  801dd9:	e8 5f f6 ff ff       	call   80143d <read>
	if (r < 0)
  801dde:	83 c4 10             	add    $0x10,%esp
  801de1:	85 c0                	test   %eax,%eax
  801de3:	78 06                	js     801deb <getchar+0x24>
	if (r < 1)
  801de5:	74 06                	je     801ded <getchar+0x26>
	return c;
  801de7:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801deb:	c9                   	leave  
  801dec:	c3                   	ret    
		return -E_EOF;
  801ded:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801df2:	eb f7                	jmp    801deb <getchar+0x24>

00801df4 <iscons>:
{
  801df4:	f3 0f 1e fb          	endbr32 
  801df8:	55                   	push   %ebp
  801df9:	89 e5                	mov    %esp,%ebp
  801dfb:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801dfe:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e01:	50                   	push   %eax
  801e02:	ff 75 08             	pushl  0x8(%ebp)
  801e05:	e8 b0 f3 ff ff       	call   8011ba <fd_lookup>
  801e0a:	83 c4 10             	add    $0x10,%esp
  801e0d:	85 c0                	test   %eax,%eax
  801e0f:	78 11                	js     801e22 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801e11:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e14:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e1a:	39 10                	cmp    %edx,(%eax)
  801e1c:	0f 94 c0             	sete   %al
  801e1f:	0f b6 c0             	movzbl %al,%eax
}
  801e22:	c9                   	leave  
  801e23:	c3                   	ret    

00801e24 <opencons>:
{
  801e24:	f3 0f 1e fb          	endbr32 
  801e28:	55                   	push   %ebp
  801e29:	89 e5                	mov    %esp,%ebp
  801e2b:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801e2e:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e31:	50                   	push   %eax
  801e32:	e8 2d f3 ff ff       	call   801164 <fd_alloc>
  801e37:	83 c4 10             	add    $0x10,%esp
  801e3a:	85 c0                	test   %eax,%eax
  801e3c:	78 3a                	js     801e78 <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801e3e:	83 ec 04             	sub    $0x4,%esp
  801e41:	68 07 04 00 00       	push   $0x407
  801e46:	ff 75 f4             	pushl  -0xc(%ebp)
  801e49:	6a 00                	push   $0x0
  801e4b:	e8 93 ed ff ff       	call   800be3 <sys_page_alloc>
  801e50:	83 c4 10             	add    $0x10,%esp
  801e53:	85 c0                	test   %eax,%eax
  801e55:	78 21                	js     801e78 <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801e57:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e5a:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801e60:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801e62:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e65:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801e6c:	83 ec 0c             	sub    $0xc,%esp
  801e6f:	50                   	push   %eax
  801e70:	e8 c0 f2 ff ff       	call   801135 <fd2num>
  801e75:	83 c4 10             	add    $0x10,%esp
}
  801e78:	c9                   	leave  
  801e79:	c3                   	ret    

00801e7a <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  801e7a:	f3 0f 1e fb          	endbr32 
  801e7e:	55                   	push   %ebp
  801e7f:	89 e5                	mov    %esp,%ebp
  801e81:	56                   	push   %esi
  801e82:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  801e83:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  801e86:	8b 35 00 30 80 00    	mov    0x803000,%esi
  801e8c:	e8 0c ed ff ff       	call   800b9d <sys_getenvid>
  801e91:	83 ec 0c             	sub    $0xc,%esp
  801e94:	ff 75 0c             	pushl  0xc(%ebp)
  801e97:	ff 75 08             	pushl  0x8(%ebp)
  801e9a:	56                   	push   %esi
  801e9b:	50                   	push   %eax
  801e9c:	68 28 29 80 00       	push   $0x802928
  801ea1:	e8 22 e3 ff ff       	call   8001c8 <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  801ea6:	83 c4 18             	add    $0x18,%esp
  801ea9:	53                   	push   %ebx
  801eaa:	ff 75 10             	pushl  0x10(%ebp)
  801ead:	e8 c1 e2 ff ff       	call   800173 <vcprintf>
	cprintf("\n");
  801eb2:	c7 04 24 b4 23 80 00 	movl   $0x8023b4,(%esp)
  801eb9:	e8 0a e3 ff ff       	call   8001c8 <cprintf>
  801ebe:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  801ec1:	cc                   	int3   
  801ec2:	eb fd                	jmp    801ec1 <_panic+0x47>

00801ec4 <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  801ec4:	f3 0f 1e fb          	endbr32 
  801ec8:	55                   	push   %ebp
  801ec9:	89 e5                	mov    %esp,%ebp
  801ecb:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801ece:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  801ed5:	74 27                	je     801efe <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801ed7:	8b 45 08             	mov    0x8(%ebp),%eax
  801eda:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  801edf:	a1 04 40 80 00       	mov    0x804004,%eax
  801ee4:	8b 40 48             	mov    0x48(%eax),%eax
  801ee7:	83 ec 08             	sub    $0x8,%esp
  801eea:	68 3e 1f 80 00       	push   $0x801f3e
  801eef:	50                   	push   %eax
  801ef0:	e8 4d ee ff ff       	call   800d42 <sys_env_set_pgfault_upcall>
  801ef5:	83 c4 10             	add    $0x10,%esp
  801ef8:	85 c0                	test   %eax,%eax
  801efa:	78 2e                	js     801f2a <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  801efc:	c9                   	leave  
  801efd:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  801efe:	83 ec 04             	sub    $0x4,%esp
  801f01:	6a 07                	push   $0x7
  801f03:	68 00 f0 bf ee       	push   $0xeebff000
  801f08:	6a 00                	push   $0x0
  801f0a:	e8 d4 ec ff ff       	call   800be3 <sys_page_alloc>
  801f0f:	83 c4 10             	add    $0x10,%esp
  801f12:	85 c0                	test   %eax,%eax
  801f14:	79 c1                	jns    801ed7 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  801f16:	83 ec 04             	sub    $0x4,%esp
  801f19:	68 4c 29 80 00       	push   $0x80294c
  801f1e:	6a 21                	push   $0x21
  801f20:	68 ae 29 80 00       	push   $0x8029ae
  801f25:	e8 50 ff ff ff       	call   801e7a <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  801f2a:	83 ec 04             	sub    $0x4,%esp
  801f2d:	68 78 29 80 00       	push   $0x802978
  801f32:	6a 27                	push   $0x27
  801f34:	68 ae 29 80 00       	push   $0x8029ae
  801f39:	e8 3c ff ff ff       	call   801e7a <_panic>

00801f3e <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  801f3e:	54                   	push   %esp
	movl _pgfault_handler, %eax
  801f3f:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  801f44:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  801f46:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  801f49:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  801f4d:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  801f50:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  801f54:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  801f58:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  801f5b:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  801f5e:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  801f5f:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  801f62:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  801f63:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  801f64:	c3                   	ret    

00801f65 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  801f65:	f3 0f 1e fb          	endbr32 
  801f69:	55                   	push   %ebp
  801f6a:	89 e5                	mov    %esp,%ebp
  801f6c:	56                   	push   %esi
  801f6d:	53                   	push   %ebx
  801f6e:	8b 75 08             	mov    0x8(%ebp),%esi
  801f71:	8b 45 0c             	mov    0xc(%ebp),%eax
  801f74:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  801f77:	85 c0                	test   %eax,%eax
  801f79:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  801f7e:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  801f81:	83 ec 0c             	sub    $0xc,%esp
  801f84:	50                   	push   %eax
  801f85:	e8 25 ee ff ff       	call   800daf <sys_ipc_recv>
  801f8a:	83 c4 10             	add    $0x10,%esp
  801f8d:	85 c0                	test   %eax,%eax
  801f8f:	78 3f                	js     801fd0 <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  801f91:	e8 07 ec ff ff       	call   800b9d <sys_getenvid>
  801f96:	25 ff 03 00 00       	and    $0x3ff,%eax
  801f9b:	6b d0 7c             	imul   $0x7c,%eax,%edx
  801f9e:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  801fa4:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  801faa:	85 f6                	test   %esi,%esi
  801fac:	74 05                	je     801fb3 <ipc_recv+0x4e>
  801fae:	8b 42 74             	mov    0x74(%edx),%eax
  801fb1:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  801fb3:	85 db                	test   %ebx,%ebx
  801fb5:	74 0a                	je     801fc1 <ipc_recv+0x5c>
  801fb7:	a1 04 40 80 00       	mov    0x804004,%eax
  801fbc:	8b 40 78             	mov    0x78(%eax),%eax
  801fbf:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  801fc1:	a1 04 40 80 00       	mov    0x804004,%eax
  801fc6:	8b 40 70             	mov    0x70(%eax),%eax
}
  801fc9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801fcc:	5b                   	pop    %ebx
  801fcd:	5e                   	pop    %esi
  801fce:	5d                   	pop    %ebp
  801fcf:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  801fd0:	85 f6                	test   %esi,%esi
  801fd2:	74 06                	je     801fda <ipc_recv+0x75>
  801fd4:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  801fda:	85 db                	test   %ebx,%ebx
  801fdc:	74 eb                	je     801fc9 <ipc_recv+0x64>
  801fde:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  801fe4:	eb e3                	jmp    801fc9 <ipc_recv+0x64>

00801fe6 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  801fe6:	f3 0f 1e fb          	endbr32 
  801fea:	55                   	push   %ebp
  801feb:	89 e5                	mov    %esp,%ebp
  801fed:	57                   	push   %edi
  801fee:	56                   	push   %esi
  801fef:	53                   	push   %ebx
  801ff0:	83 ec 0c             	sub    $0xc,%esp
  801ff3:	8b 7d 08             	mov    0x8(%ebp),%edi
  801ff6:	8b 75 0c             	mov    0xc(%ebp),%esi
  801ff9:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  801ffc:	85 db                	test   %ebx,%ebx
  801ffe:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  802003:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  802006:	ff 75 14             	pushl  0x14(%ebp)
  802009:	53                   	push   %ebx
  80200a:	56                   	push   %esi
  80200b:	57                   	push   %edi
  80200c:	e8 77 ed ff ff       	call   800d88 <sys_ipc_try_send>
  802011:	83 c4 10             	add    $0x10,%esp
  802014:	85 c0                	test   %eax,%eax
  802016:	79 1e                	jns    802036 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802018:	83 f8 f9             	cmp    $0xfffffff9,%eax
  80201b:	75 07                	jne    802024 <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  80201d:	e8 9e eb ff ff       	call   800bc0 <sys_yield>
  802022:	eb e2                	jmp    802006 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  802024:	50                   	push   %eax
  802025:	68 bc 29 80 00       	push   $0x8029bc
  80202a:	6a 3b                	push   $0x3b
  80202c:	68 d0 29 80 00       	push   $0x8029d0
  802031:	e8 44 fe ff ff       	call   801e7a <_panic>
	}
}
  802036:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802039:	5b                   	pop    %ebx
  80203a:	5e                   	pop    %esi
  80203b:	5f                   	pop    %edi
  80203c:	5d                   	pop    %ebp
  80203d:	c3                   	ret    

0080203e <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  80203e:	f3 0f 1e fb          	endbr32 
  802042:	55                   	push   %ebp
  802043:	89 e5                	mov    %esp,%ebp
  802045:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802048:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  80204d:	6b d0 7c             	imul   $0x7c,%eax,%edx
  802050:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802056:	8b 52 50             	mov    0x50(%edx),%edx
  802059:	39 ca                	cmp    %ecx,%edx
  80205b:	74 11                	je     80206e <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  80205d:	83 c0 01             	add    $0x1,%eax
  802060:	3d 00 04 00 00       	cmp    $0x400,%eax
  802065:	75 e6                	jne    80204d <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802067:	b8 00 00 00 00       	mov    $0x0,%eax
  80206c:	eb 0b                	jmp    802079 <ipc_find_env+0x3b>
			return envs[i].env_id;
  80206e:	6b c0 7c             	imul   $0x7c,%eax,%eax
  802071:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  802076:	8b 40 48             	mov    0x48(%eax),%eax
}
  802079:	5d                   	pop    %ebp
  80207a:	c3                   	ret    

0080207b <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  80207b:	f3 0f 1e fb          	endbr32 
  80207f:	55                   	push   %ebp
  802080:	89 e5                	mov    %esp,%ebp
  802082:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  802085:	89 c2                	mov    %eax,%edx
  802087:	c1 ea 16             	shr    $0x16,%edx
  80208a:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  802091:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  802096:	f6 c1 01             	test   $0x1,%cl
  802099:	74 1c                	je     8020b7 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  80209b:	c1 e8 0c             	shr    $0xc,%eax
  80209e:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8020a5:	a8 01                	test   $0x1,%al
  8020a7:	74 0e                	je     8020b7 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8020a9:	c1 e8 0c             	shr    $0xc,%eax
  8020ac:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8020b3:	ef 
  8020b4:	0f b7 d2             	movzwl %dx,%edx
}
  8020b7:	89 d0                	mov    %edx,%eax
  8020b9:	5d                   	pop    %ebp
  8020ba:	c3                   	ret    
  8020bb:	66 90                	xchg   %ax,%ax
  8020bd:	66 90                	xchg   %ax,%ax
  8020bf:	90                   	nop

008020c0 <__udivdi3>:
  8020c0:	f3 0f 1e fb          	endbr32 
  8020c4:	55                   	push   %ebp
  8020c5:	57                   	push   %edi
  8020c6:	56                   	push   %esi
  8020c7:	53                   	push   %ebx
  8020c8:	83 ec 1c             	sub    $0x1c,%esp
  8020cb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8020cf:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8020d3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8020d7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8020db:	85 d2                	test   %edx,%edx
  8020dd:	75 19                	jne    8020f8 <__udivdi3+0x38>
  8020df:	39 f3                	cmp    %esi,%ebx
  8020e1:	76 4d                	jbe    802130 <__udivdi3+0x70>
  8020e3:	31 ff                	xor    %edi,%edi
  8020e5:	89 e8                	mov    %ebp,%eax
  8020e7:	89 f2                	mov    %esi,%edx
  8020e9:	f7 f3                	div    %ebx
  8020eb:	89 fa                	mov    %edi,%edx
  8020ed:	83 c4 1c             	add    $0x1c,%esp
  8020f0:	5b                   	pop    %ebx
  8020f1:	5e                   	pop    %esi
  8020f2:	5f                   	pop    %edi
  8020f3:	5d                   	pop    %ebp
  8020f4:	c3                   	ret    
  8020f5:	8d 76 00             	lea    0x0(%esi),%esi
  8020f8:	39 f2                	cmp    %esi,%edx
  8020fa:	76 14                	jbe    802110 <__udivdi3+0x50>
  8020fc:	31 ff                	xor    %edi,%edi
  8020fe:	31 c0                	xor    %eax,%eax
  802100:	89 fa                	mov    %edi,%edx
  802102:	83 c4 1c             	add    $0x1c,%esp
  802105:	5b                   	pop    %ebx
  802106:	5e                   	pop    %esi
  802107:	5f                   	pop    %edi
  802108:	5d                   	pop    %ebp
  802109:	c3                   	ret    
  80210a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802110:	0f bd fa             	bsr    %edx,%edi
  802113:	83 f7 1f             	xor    $0x1f,%edi
  802116:	75 48                	jne    802160 <__udivdi3+0xa0>
  802118:	39 f2                	cmp    %esi,%edx
  80211a:	72 06                	jb     802122 <__udivdi3+0x62>
  80211c:	31 c0                	xor    %eax,%eax
  80211e:	39 eb                	cmp    %ebp,%ebx
  802120:	77 de                	ja     802100 <__udivdi3+0x40>
  802122:	b8 01 00 00 00       	mov    $0x1,%eax
  802127:	eb d7                	jmp    802100 <__udivdi3+0x40>
  802129:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802130:	89 d9                	mov    %ebx,%ecx
  802132:	85 db                	test   %ebx,%ebx
  802134:	75 0b                	jne    802141 <__udivdi3+0x81>
  802136:	b8 01 00 00 00       	mov    $0x1,%eax
  80213b:	31 d2                	xor    %edx,%edx
  80213d:	f7 f3                	div    %ebx
  80213f:	89 c1                	mov    %eax,%ecx
  802141:	31 d2                	xor    %edx,%edx
  802143:	89 f0                	mov    %esi,%eax
  802145:	f7 f1                	div    %ecx
  802147:	89 c6                	mov    %eax,%esi
  802149:	89 e8                	mov    %ebp,%eax
  80214b:	89 f7                	mov    %esi,%edi
  80214d:	f7 f1                	div    %ecx
  80214f:	89 fa                	mov    %edi,%edx
  802151:	83 c4 1c             	add    $0x1c,%esp
  802154:	5b                   	pop    %ebx
  802155:	5e                   	pop    %esi
  802156:	5f                   	pop    %edi
  802157:	5d                   	pop    %ebp
  802158:	c3                   	ret    
  802159:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802160:	89 f9                	mov    %edi,%ecx
  802162:	b8 20 00 00 00       	mov    $0x20,%eax
  802167:	29 f8                	sub    %edi,%eax
  802169:	d3 e2                	shl    %cl,%edx
  80216b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80216f:	89 c1                	mov    %eax,%ecx
  802171:	89 da                	mov    %ebx,%edx
  802173:	d3 ea                	shr    %cl,%edx
  802175:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802179:	09 d1                	or     %edx,%ecx
  80217b:	89 f2                	mov    %esi,%edx
  80217d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  802181:	89 f9                	mov    %edi,%ecx
  802183:	d3 e3                	shl    %cl,%ebx
  802185:	89 c1                	mov    %eax,%ecx
  802187:	d3 ea                	shr    %cl,%edx
  802189:	89 f9                	mov    %edi,%ecx
  80218b:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  80218f:	89 eb                	mov    %ebp,%ebx
  802191:	d3 e6                	shl    %cl,%esi
  802193:	89 c1                	mov    %eax,%ecx
  802195:	d3 eb                	shr    %cl,%ebx
  802197:	09 de                	or     %ebx,%esi
  802199:	89 f0                	mov    %esi,%eax
  80219b:	f7 74 24 08          	divl   0x8(%esp)
  80219f:	89 d6                	mov    %edx,%esi
  8021a1:	89 c3                	mov    %eax,%ebx
  8021a3:	f7 64 24 0c          	mull   0xc(%esp)
  8021a7:	39 d6                	cmp    %edx,%esi
  8021a9:	72 15                	jb     8021c0 <__udivdi3+0x100>
  8021ab:	89 f9                	mov    %edi,%ecx
  8021ad:	d3 e5                	shl    %cl,%ebp
  8021af:	39 c5                	cmp    %eax,%ebp
  8021b1:	73 04                	jae    8021b7 <__udivdi3+0xf7>
  8021b3:	39 d6                	cmp    %edx,%esi
  8021b5:	74 09                	je     8021c0 <__udivdi3+0x100>
  8021b7:	89 d8                	mov    %ebx,%eax
  8021b9:	31 ff                	xor    %edi,%edi
  8021bb:	e9 40 ff ff ff       	jmp    802100 <__udivdi3+0x40>
  8021c0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8021c3:	31 ff                	xor    %edi,%edi
  8021c5:	e9 36 ff ff ff       	jmp    802100 <__udivdi3+0x40>
  8021ca:	66 90                	xchg   %ax,%ax
  8021cc:	66 90                	xchg   %ax,%ax
  8021ce:	66 90                	xchg   %ax,%ax

008021d0 <__umoddi3>:
  8021d0:	f3 0f 1e fb          	endbr32 
  8021d4:	55                   	push   %ebp
  8021d5:	57                   	push   %edi
  8021d6:	56                   	push   %esi
  8021d7:	53                   	push   %ebx
  8021d8:	83 ec 1c             	sub    $0x1c,%esp
  8021db:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8021df:	8b 74 24 30          	mov    0x30(%esp),%esi
  8021e3:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  8021e7:	8b 7c 24 38          	mov    0x38(%esp),%edi
  8021eb:	85 c0                	test   %eax,%eax
  8021ed:	75 19                	jne    802208 <__umoddi3+0x38>
  8021ef:	39 df                	cmp    %ebx,%edi
  8021f1:	76 5d                	jbe    802250 <__umoddi3+0x80>
  8021f3:	89 f0                	mov    %esi,%eax
  8021f5:	89 da                	mov    %ebx,%edx
  8021f7:	f7 f7                	div    %edi
  8021f9:	89 d0                	mov    %edx,%eax
  8021fb:	31 d2                	xor    %edx,%edx
  8021fd:	83 c4 1c             	add    $0x1c,%esp
  802200:	5b                   	pop    %ebx
  802201:	5e                   	pop    %esi
  802202:	5f                   	pop    %edi
  802203:	5d                   	pop    %ebp
  802204:	c3                   	ret    
  802205:	8d 76 00             	lea    0x0(%esi),%esi
  802208:	89 f2                	mov    %esi,%edx
  80220a:	39 d8                	cmp    %ebx,%eax
  80220c:	76 12                	jbe    802220 <__umoddi3+0x50>
  80220e:	89 f0                	mov    %esi,%eax
  802210:	89 da                	mov    %ebx,%edx
  802212:	83 c4 1c             	add    $0x1c,%esp
  802215:	5b                   	pop    %ebx
  802216:	5e                   	pop    %esi
  802217:	5f                   	pop    %edi
  802218:	5d                   	pop    %ebp
  802219:	c3                   	ret    
  80221a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802220:	0f bd e8             	bsr    %eax,%ebp
  802223:	83 f5 1f             	xor    $0x1f,%ebp
  802226:	75 50                	jne    802278 <__umoddi3+0xa8>
  802228:	39 d8                	cmp    %ebx,%eax
  80222a:	0f 82 e0 00 00 00    	jb     802310 <__umoddi3+0x140>
  802230:	89 d9                	mov    %ebx,%ecx
  802232:	39 f7                	cmp    %esi,%edi
  802234:	0f 86 d6 00 00 00    	jbe    802310 <__umoddi3+0x140>
  80223a:	89 d0                	mov    %edx,%eax
  80223c:	89 ca                	mov    %ecx,%edx
  80223e:	83 c4 1c             	add    $0x1c,%esp
  802241:	5b                   	pop    %ebx
  802242:	5e                   	pop    %esi
  802243:	5f                   	pop    %edi
  802244:	5d                   	pop    %ebp
  802245:	c3                   	ret    
  802246:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80224d:	8d 76 00             	lea    0x0(%esi),%esi
  802250:	89 fd                	mov    %edi,%ebp
  802252:	85 ff                	test   %edi,%edi
  802254:	75 0b                	jne    802261 <__umoddi3+0x91>
  802256:	b8 01 00 00 00       	mov    $0x1,%eax
  80225b:	31 d2                	xor    %edx,%edx
  80225d:	f7 f7                	div    %edi
  80225f:	89 c5                	mov    %eax,%ebp
  802261:	89 d8                	mov    %ebx,%eax
  802263:	31 d2                	xor    %edx,%edx
  802265:	f7 f5                	div    %ebp
  802267:	89 f0                	mov    %esi,%eax
  802269:	f7 f5                	div    %ebp
  80226b:	89 d0                	mov    %edx,%eax
  80226d:	31 d2                	xor    %edx,%edx
  80226f:	eb 8c                	jmp    8021fd <__umoddi3+0x2d>
  802271:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802278:	89 e9                	mov    %ebp,%ecx
  80227a:	ba 20 00 00 00       	mov    $0x20,%edx
  80227f:	29 ea                	sub    %ebp,%edx
  802281:	d3 e0                	shl    %cl,%eax
  802283:	89 44 24 08          	mov    %eax,0x8(%esp)
  802287:	89 d1                	mov    %edx,%ecx
  802289:	89 f8                	mov    %edi,%eax
  80228b:	d3 e8                	shr    %cl,%eax
  80228d:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802291:	89 54 24 04          	mov    %edx,0x4(%esp)
  802295:	8b 54 24 04          	mov    0x4(%esp),%edx
  802299:	09 c1                	or     %eax,%ecx
  80229b:	89 d8                	mov    %ebx,%eax
  80229d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022a1:	89 e9                	mov    %ebp,%ecx
  8022a3:	d3 e7                	shl    %cl,%edi
  8022a5:	89 d1                	mov    %edx,%ecx
  8022a7:	d3 e8                	shr    %cl,%eax
  8022a9:	89 e9                	mov    %ebp,%ecx
  8022ab:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8022af:	d3 e3                	shl    %cl,%ebx
  8022b1:	89 c7                	mov    %eax,%edi
  8022b3:	89 d1                	mov    %edx,%ecx
  8022b5:	89 f0                	mov    %esi,%eax
  8022b7:	d3 e8                	shr    %cl,%eax
  8022b9:	89 e9                	mov    %ebp,%ecx
  8022bb:	89 fa                	mov    %edi,%edx
  8022bd:	d3 e6                	shl    %cl,%esi
  8022bf:	09 d8                	or     %ebx,%eax
  8022c1:	f7 74 24 08          	divl   0x8(%esp)
  8022c5:	89 d1                	mov    %edx,%ecx
  8022c7:	89 f3                	mov    %esi,%ebx
  8022c9:	f7 64 24 0c          	mull   0xc(%esp)
  8022cd:	89 c6                	mov    %eax,%esi
  8022cf:	89 d7                	mov    %edx,%edi
  8022d1:	39 d1                	cmp    %edx,%ecx
  8022d3:	72 06                	jb     8022db <__umoddi3+0x10b>
  8022d5:	75 10                	jne    8022e7 <__umoddi3+0x117>
  8022d7:	39 c3                	cmp    %eax,%ebx
  8022d9:	73 0c                	jae    8022e7 <__umoddi3+0x117>
  8022db:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8022df:	1b 54 24 08          	sbb    0x8(%esp),%edx
  8022e3:	89 d7                	mov    %edx,%edi
  8022e5:	89 c6                	mov    %eax,%esi
  8022e7:	89 ca                	mov    %ecx,%edx
  8022e9:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  8022ee:	29 f3                	sub    %esi,%ebx
  8022f0:	19 fa                	sbb    %edi,%edx
  8022f2:	89 d0                	mov    %edx,%eax
  8022f4:	d3 e0                	shl    %cl,%eax
  8022f6:	89 e9                	mov    %ebp,%ecx
  8022f8:	d3 eb                	shr    %cl,%ebx
  8022fa:	d3 ea                	shr    %cl,%edx
  8022fc:	09 d8                	or     %ebx,%eax
  8022fe:	83 c4 1c             	add    $0x1c,%esp
  802301:	5b                   	pop    %ebx
  802302:	5e                   	pop    %esi
  802303:	5f                   	pop    %edi
  802304:	5d                   	pop    %ebp
  802305:	c3                   	ret    
  802306:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80230d:	8d 76 00             	lea    0x0(%esi),%esi
  802310:	29 fe                	sub    %edi,%esi
  802312:	19 c3                	sbb    %eax,%ebx
  802314:	89 f2                	mov    %esi,%edx
  802316:	89 d9                	mov    %ebx,%ecx
  802318:	e9 1d ff ff ff       	jmp    80223a <__umoddi3+0x6a>
